Class TreeList.TreeListIterator<E>
java.lang.Object
org.apache.commons.collections4.list.TreeList.TreeListIterator<E>
- All Implemented Interfaces:
Iterator<E>, ListIterator<E>, OrderedIterator<E>
static class TreeList.TreeListIterator<E>
extends Object
implements ListIterator<E>, OrderedIterator<E>
A list iterator over the linked list.
- Since:
- 3.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TreeList.AVLNode<E> Cache of the last node that was returned bynext()orprevious().private intThe index of the last node that was returned.private intThe modification count that the list is expected to have.private TreeList.AVLNode<E> Cache of the next node that will be returned bynext().private intThe index of the next node to be returned.The parent list -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTreeListIterator(TreeList<E> parent, int fromIndex) Create a ListIterator for a list. -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidChecks the modification count of the list is the value that this object expects.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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
-
Field Details
-
parent
-
next
Cache of the next node that will be returned bynext(). -
nextIndex
private int nextIndexThe index of the next node to be returned. -
current
Cache of the last node that was returned bynext()orprevious(). -
currentIndex
private int currentIndexThe index of the last node that was returned. -
expectedModCount
private 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
-
TreeListIterator
Create a ListIterator for a list.- Parameters:
parent- the parent listfromIndex- the index to start at- Throws:
IndexOutOfBoundsException
-
-
Method Details
-
checkModCount
protected 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.
-
hasNext
-
next
-
hasPrevious
public boolean hasPrevious()Description copied from interface:OrderedIteratorChecks to see if there is a previous element that can be iterated to.- Specified by:
hasPreviousin interfaceListIterator<E>- Specified by:
hasPreviousin interfaceOrderedIterator<E>- Returns:
trueif the iterator has a previous element
-
previous
Description copied from interface:OrderedIteratorGets the previous element from the container.- Specified by:
previousin interfaceListIterator<E>- Specified by:
previousin interfaceOrderedIterator<E>- Returns:
- the previous element in the iteration
-
nextIndex
public int nextIndex()- Specified by:
nextIndexin interfaceListIterator<E>
-
previousIndex
public int previousIndex()- Specified by:
previousIndexin interfaceListIterator<E>
-
remove
-
set
- Specified by:
setin interfaceListIterator<E>
-
add
- Specified by:
addin interfaceListIterator<E>
-