Class AbstractLinkedList.LinkedListIterator
java.lang.Object
org.apache.commons.collections.list.AbstractLinkedList.LinkedListIterator
- All Implemented Interfaces:
- Iterator,- ListIterator,- OrderedIterator
- Direct Known Subclasses:
- AbstractLinkedList.LinkedSubListIterator,- CursorableLinkedList.Cursor
- Enclosing class:
- AbstractLinkedList
protected static class AbstractLinkedList.LinkedListIterator
extends Object
implements ListIterator, OrderedIterator
A list iterator over the linked list.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected AbstractLinkedList.NodeThe last node that was returned bynext()orprevious().protected intThe modification count that the list is expected to have.protected AbstractLinkedList.NodeThe node that will be returned bynext().protected intThe index ofnext.protected final AbstractLinkedListThe parent list
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedLinkedListIterator(AbstractLinkedList parent, int fromIndex) Create a ListIterator for a list.
- 
Method SummaryModifier and TypeMethodDescriptionvoidprotected voidChecks the modification count of the list is the value that this object expects.protected AbstractLinkedList.NodeGets the last node returned.booleanhasNext()booleanChecks to see if there is a previous element that can be iterated to.next()intprevious()Gets the previous element from the collection.intvoidremove()voidMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.IteratorforEachRemaining
- 
Field Details- 
parentThe parent list
- 
nextThe node that will be returned bynext(). If this is equal toAbstractLinkedList.headerthen there are no more values to return.
- 
nextIndexprotected int nextIndexThe index ofnext.
- 
currentThe last node that was returned bynext()orprevious(). Set tonullifnext()orprevious()haven't been called, or if the node has been removed withremove()or a new node added withadd(Object). Should be accessed throughgetLastNodeReturned()to enforce this behaviour.
- 
expectedModCountprotected int expectedModCountThe modification count that the list is expected to have. If the list doesn't have this count, then aConcurrentModificationExceptionmay be thrown by the operations.
 
- 
- 
Constructor Details- 
LinkedListIteratorprotected LinkedListIterator(AbstractLinkedList parent, int fromIndex) throws IndexOutOfBoundsException Create a ListIterator for a list.- Parameters:
- parent- the parent list
- fromIndex- the index to start at
- Throws:
- IndexOutOfBoundsException
 
 
- 
- 
Method Details- 
checkModCountprotected void checkModCount()Checks the modification count of the list is the value that this object expects.- Throws:
- ConcurrentModificationException- If the list's modification count isn't the value that was expected.
 
- 
getLastNodeReturnedGets the last node returned.- Throws:
- IllegalStateException- If- next()or- previous()haven't been called, or if the node has been removed with- remove()or a new node added with- add(Object).
 
- 
hasNextpublic boolean hasNext()- Specified by:
- hasNextin interface- Iterator
- Specified by:
- hasNextin interface- ListIterator
 
- 
next- Specified by:
- nextin interface- Iterator
- Specified by:
- nextin interface- ListIterator
 
- 
hasPreviouspublic boolean hasPrevious()Description copied from interface:OrderedIteratorChecks to see if there is a previous element that can be iterated to.- Specified by:
- hasPreviousin interface- ListIterator
- Specified by:
- hasPreviousin interface- OrderedIterator
- Returns:
- trueif the iterator has a previous element
 
- 
previousDescription copied from interface:OrderedIteratorGets the previous element from the collection.- Specified by:
- previousin interface- ListIterator
- Specified by:
- previousin interface- OrderedIterator
- Returns:
- the previous element in the iteration
 
- 
nextIndexpublic int nextIndex()- Specified by:
- nextIndexin interface- ListIterator
 
- 
previousIndexpublic int previousIndex()- Specified by:
- previousIndexin interface- ListIterator
 
- 
removepublic void remove()- Specified by:
- removein interface- Iterator
- Specified by:
- removein interface- ListIterator
 
- 
set- Specified by:
- setin interface- ListIterator
 
- 
add- Specified by:
- addin interface- ListIterator
 
 
-