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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TreeList.AVLNode
<E> Cache of the last node that was returned bynext()
orprevious()
.private int
The index of the last node that was returned.private int
The modification count that the list is expected to have.private TreeList.AVLNode
<E> Cache of the next node that will be returned bynext()
.private int
The index of the next node to be returned.The parent list -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TreeListIterator
(TreeList<E> 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 container.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
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 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() -
next
-
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<E>
- Specified by:
hasPrevious
in interfaceOrderedIterator<E>
- Returns:
true
if the iterator has a previous element
-
previous
Description copied from interface:OrderedIterator
Gets the previous element from the container.- Specified by:
previous
in interfaceListIterator<E>
- Specified by:
previous
in interfaceOrderedIterator<E>
- Returns:
- the previous element in the iteration
-
nextIndex
public int nextIndex()- Specified by:
nextIndex
in interfaceListIterator<E>
-
previousIndex
public int previousIndex()- Specified by:
previousIndex
in interfaceListIterator<E>
-
remove
public void remove() -
set
- Specified by:
set
in interfaceListIterator<E>
-
add
- Specified by:
add
in interfaceListIterator<E>
-