/** sublists contains elements at indexes offset from their base */ public void testSubList() { List a = populatedArray(10); assertTrue(a.subList(1, 1).isEmpty()); for (int j = 0; j < 9; ++j) { for (int i = j; i < 10; ++i) { List b = a.subList(j, i); for (int k = j; k < i; ++k) { assertEquals(new Integer(k), b.get(k - j)); } } } List s = a.subList(2, 5); assertEquals(3, s.size()); s.set(2, m1); assertEquals(a.get(4), m1); s.clear(); assertEquals(7, a.size()); }
/** clear removes all elements from the list */ public void testClear() { List full = populatedArray(SIZE); full.clear(); assertEquals(0, full.size()); }