Class AbstractLinkedListJava21.LinkedListIterator<E>
java.lang.Object
org.apache.commons.collections4.list.AbstractLinkedListJava21.LinkedListIterator<E>
- Type Parameters:
- E- the type of elements in this iterator.
- All Implemented Interfaces:
- Iterator<E>,- ListIterator<E>,- OrderedIterator<E>
- Direct Known Subclasses:
- AbstractLinkedListJava21.LinkedSubListIterator
- Enclosing class:
- AbstractLinkedListJava21<E>
protected static class AbstractLinkedListJava21.LinkedListIterator<E>
extends Object
implements ListIterator<E>, OrderedIterator<E>
A list iterator over the linked list.
- Since:
- 4.5.0-M3
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected AbstractLinkedListJava21.Node<E> The last node that was returned bynext()orprevious().protected intThe modification count that the list is expected to have.protected AbstractLinkedListJava21.Node<E> The node that will be returned bynext().protected intThe index ofnext.protected final AbstractLinkedListJava21<E> The parent list
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedLinkedListIterator(AbstractLinkedListJava21<E> 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 AbstractLinkedListJava21.Node<E> Gets 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 container.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 toAbstractLinkedListJava21.headerthen there are no more values to return.
- 
nextIndex
- 
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 behavior.
- 
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(AbstractLinkedListJava21<E> parent, int fromIndex) throws IndexOutOfBoundsException Create a ListIterator for a list.- Parameters:
- parent- the parent list
- fromIndex- the index to start at
- Throws:
- IndexOutOfBoundsException- if fromIndex is less than 0 or greater than the size of the list
 
 
- 
- 
Method Details- 
add- Specified by:
- addin interface- ListIterator<E>
 
- 
checkModCountChecks 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.- Returns:
- 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).
 
- 
hasNext
- 
hasPreviousDescription copied from interface:OrderedIteratorChecks to see if there is a previous element that can be iterated to.- Specified by:
- hasPreviousin interface- ListIterator<E>
- Specified by:
- hasPreviousin interface- OrderedIterator<E>
- Returns:
- trueif the iterator has a previous element
 
- 
next
- 
nextIndex- Specified by:
- nextIndexin interface- ListIterator<E>
 
- 
previousDescription copied from interface:OrderedIteratorGets the previous element from the container.- Specified by:
- previousin interface- ListIterator<E>
- Specified by:
- previousin interface- OrderedIterator<E>
- Returns:
- the previous element in the iteration
 
- 
previousIndex- Specified by:
- previousIndexin interface- ListIterator<E>
 
- 
remove
- 
set- Specified by:
- setin interface- ListIterator<E>
 
 
-