/** iterator() returns an iterator containing the elements of the list */ public void testIterator() { List full = populatedArray(SIZE); Iterator i = full.iterator(); int j; for (j = 0; i.hasNext(); j++) assertEquals(j, ((Integer) i.next()).intValue()); assertEquals(SIZE, j); }
/** iterator.remove removes element */ public void testIteratorRemove() { List full = populatedArray(SIZE); Iterator it = full.iterator(); Object first = full.get(0); it.next(); it.remove(); assertFalse(full.contains(first)); }