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.AVLNode
Cache of the last node that was returned bynext()
orprevious()
.protected int
The index of the last node that was returned.protected int
The modification count that the list is expected to have.protected TreeList.AVLNode
Cache of the next node that will be returned bynext()
.protected int
The index of the next node to be returned.protected final TreeList
The parent list -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TreeListIterator
(TreeList parent, int fromIndex) Create a ListIterator for a list. -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
Checks the modification count of the list is the value that this object expects.boolean
hasNext()
boolean
Checks to see if there is a previous element that can be iterated to.next()
int
previous()
Gets the previous element from the collection.int
void
remove()
void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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 aConcurrentModificationException
may 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:
hasNext
in interfaceIterator
- Specified by:
hasNext
in interfaceListIterator
-
next
- Specified by:
next
in interfaceIterator
- Specified by:
next
in interfaceListIterator
-
hasPrevious
public boolean hasPrevious()Description copied from interface:OrderedIterator
Checks to see if there is a previous element that can be iterated to.- Specified by:
hasPrevious
in interfaceListIterator
- Specified by:
hasPrevious
in interfaceOrderedIterator
- Returns:
true
if the iterator has a previous element
-
previous
Description copied from interface:OrderedIterator
Gets the previous element from the collection.- Specified by:
previous
in interfaceListIterator
- Specified by:
previous
in interfaceOrderedIterator
- Returns:
- the previous element in the iteration
-
nextIndex
public int nextIndex()- Specified by:
nextIndex
in interfaceListIterator
-
previousIndex
public int previousIndex()- Specified by:
previousIndex
in interfaceListIterator
-
remove
public void remove()- Specified by:
remove
in interfaceIterator
- Specified by:
remove
in interfaceListIterator
-
set
- Specified by:
set
in interfaceListIterator
-
add
- Specified by:
add
in interfaceListIterator
-