public Object previous() { checkModCount(); if (!hasPrevious()) { throw new NoSuchElementException("Already at start of list."); } next = next.previous; Object value = next.getValue(); current = next; nextIndex--; return value; }
public Object next() { checkModCount(); if (!hasNext()) { throw new NoSuchElementException("No element at index " + nextIndex + "."); } Object value = next.getValue(); current = next; next = next.next; nextIndex++; return value; }
public ListIterator listIterator(int fromIndex) { return new LinkedListIterator(this, fromIndex); }
public int nextIndex() { return (super.nextIndex() - sub.offset); }
public void remove() { checkModCount(); if (current == next) { // remove() following previous() next = next.next; parent.removeNode(getLastNodeReturned()); } else { // remove() following next() parent.removeNode(getLastNodeReturned()); nextIndex--; } current = null; expectedModCount++; }
public void remove() { checkModCount(); if (current == next) { // remove() following previous() next = next.next; parent.removeNode(getLastNodeReturned()); } else { // remove() following next() parent.removeNode(getLastNodeReturned()); nextIndex--; } current = null; expectedModCount++; }
public ListIterator listIterator() { return new LinkedListIterator(this, 0); }
public ListIterator listIterator(int fromIndex) { return new LinkedListIterator(this, fromIndex); }
public int nextIndex() { return (super.nextIndex() - sub.offset); }
public ListIterator listIterator(int fromIndex) { return new LinkedListIterator(this, fromIndex); }
public int nextIndex() { return (super.nextIndex() - sub.offset); }
public ListIterator listIterator() { return new LinkedListIterator(this, 0); }
public void remove() { checkModCount(); if (current == next) { // remove() following previous() next = next.next; parent.removeNode(getLastNodeReturned()); } else { // remove() following next() parent.removeNode(getLastNodeReturned()); nextIndex--; } current = null; expectedModCount++; }
public void remove() { checkModCount(); if (current == next) { // remove() following previous() next = next.next; parent.removeNode(getLastNodeReturned()); } else { // remove() following next() parent.removeNode(getLastNodeReturned()); nextIndex--; } current = null; expectedModCount++; }
public int previousIndex() { // not normally overridden, as relative to nextIndex() return nextIndex() - 1; }
/** * Adds an object to the list. * The object added here will be the new 'previous' in the iterator. * * @param obj the object to add */ public void add(Object obj) { // overridden, as the nodeInserted() method updates the iterator state super.add(obj); // matches the (next.previous == node) clause in nodeInserted() // thus next gets changed - reset it again here next = next.next; }
/** * Adds an object to the list. * The object added here will be the new 'previous' in the iterator. * * @param obj the object to add */ public void add(Object obj) { // overridden, as the nodeInserted() method updates the iterator state super.add(obj); // matches the (next.previous == node) clause in nodeInserted() // thus next gets changed - reset it again here next = next.next; }
public int previousIndex() { // not normally overridden, as relative to nextIndex() return nextIndex() - 1; }
/** * Adds an object to the list. * The object added here will be the new 'previous' in the iterator. * * @param obj the object to add */ public void add(Object obj) { // overridden, as the nodeInserted() method updates the iterator state super.add(obj); // matches the (next.previous == node) clause in nodeInserted() // thus next gets changed - reset it again here next = next.next; }
public int nextIndex() { return (super.nextIndex() - sub.offset); }