/** * Removes all nodes by iteration. */ protected void removeAllNodes() { if (size() > 0) { // superclass implementation would break all the iterators Iterator it = iterator(); while (it.hasNext()) { it.next(); it.remove(); } } }
/** * Removes all nodes by iteration. */ protected void removeAllNodes() { if (size() > 0) { // superclass implementation would break all the iterators Iterator it = iterator(); while (it.hasNext()) { it.next(); it.remove(); } } }
public void testCursorNextIndexMid() { list.add("1"); list.add("2"); list.add("3"); list.add("5"); CursorableLinkedList.Cursor c1 = list.cursor(); Iterator li = list.iterator(); // test cursors remain valid when list modified by std Iterator // test cursors skip elements removed via ListIterator assertEquals("1", li.next()); assertEquals("2", li.next()); li.remove(); assertEquals(0, c1.nextIndex()); assertEquals("1", c1.next()); assertEquals(1, c1.nextIndex()); assertEquals("3", c1.next()); }
Iterator li = list.iterator();
/** * Removes all nodes by iteration. */ protected void removeAllNodes() { if (size() > 0) { // superclass implementation would break all the iterators Iterator it = iterator(); while (it.hasNext()) { it.next(); it.remove(); } } }
/** * Removes all nodes by iteration. */ protected void removeAllNodes() { if (size() > 0) { // superclass implementation would break all the iterators Iterator it = iterator(); while (it.hasNext()) { it.next(); it.remove(); } } }
/** * Removes all nodes by iteration. */ protected void removeAllNodes() { if (size() > 0) { // superclass implementation would break all the iterators Iterator it = iterator(); while (it.hasNext()) { it.next(); it.remove(); } } }
/** * Removes all nodes by iteration. */ protected void removeAllNodes() { if (size() > 0) { // superclass implementation would break all the iterators Iterator it = iterator(); while (it.hasNext()) { it.next(); it.remove(); } } }
/** * Removes all nodes by iteration. */ protected void removeAllNodes() { if (size() > 0) { // superclass implementation would break all the iterators Iterator it = iterator(); while (it.hasNext()) { it.next(); it.remove(); } } }