Class TreeList.TreeListIterator
java.lang.Object
org.apache.commons.collections.list.TreeList.TreeListIterator
- All Implemented Interfaces:
Iterator,ListIterator,OrderedIterator
- Enclosing class:
TreeList
A list iterator over the linked list.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TreeList.AVLNodeCache of the last node that was returned bynext()orprevious().protected intThe index of the last node that was returned.protected intThe modification count that the list is expected to have.protected TreeList.AVLNodeCache of the next node that will be returned bynext().protected intThe index of the next node to be returned.protected final TreeListThe parent list -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTreeListIterator(TreeList 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 collection.intvoidremove()voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
parent
The parent list -
next
Cache of the next node that will be returned bynext(). -
nextIndex
protected int nextIndexThe index of the next node to be returned. -
current
Cache of the last node that was returned bynext()orprevious(). -
currentIndex
protected int currentIndexThe index of the last node that was returned. -
expectedModCount
protected 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
public boolean hasNext()- Specified by:
hasNextin interfaceIterator- Specified by:
hasNextin interfaceListIterator
-
next
- Specified by:
nextin interfaceIterator- Specified by:
nextin interfaceListIterator
-
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- Specified by:
hasPreviousin interfaceOrderedIterator- Returns:
trueif the iterator has a previous element
-
previous
Description copied from interface:OrderedIteratorGets the previous element from the collection.- Specified by:
previousin interfaceListIterator- Specified by:
previousin interfaceOrderedIterator- Returns:
- the previous element in the iteration
-
nextIndex
public int nextIndex()- Specified by:
nextIndexin interfaceListIterator
-
previousIndex
public int previousIndex()- Specified by:
previousIndexin interfaceListIterator
-
remove
public void remove()- Specified by:
removein interfaceIterator- Specified by:
removein interfaceListIterator
-
set
- Specified by:
setin interfaceListIterator
-
add
- Specified by:
addin interfaceListIterator
-