Class TreeList.TreeListIterator<E>
- java.lang.Object
-
- org.apache.commons.collections4.list.TreeList.TreeListIterator<E>
-
- All Implemented Interfaces:
java.util.Iterator<E>
,java.util.ListIterator<E>
,OrderedIterator<E>
static class TreeList.TreeListIterator<E> extends java.lang.Object implements java.util.ListIterator<E>, OrderedIterator<E>
A list iterator over the linked list.
-
-
Field Summary
Fields Modifier and Type Field Description private TreeList.AVLNode<E>
current
Cache of the last node that was returned bynext()
orprevious()
.private int
currentIndex
The index of the last node that was returned.private int
expectedModCount
The modification count that the list is expected to have.private TreeList.AVLNode<E>
next
Cache of the next node that will be returned bynext()
.private int
nextIndex
The index of the next node to be returned.private TreeList<E>
parent
The parent list
-
Constructor Summary
Constructors Modifier Constructor Description protected
TreeListIterator(TreeList<E> parent, int fromIndex)
Create a ListIterator for a list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(E obj)
protected void
checkModCount()
Checks the modification count of the list is the value that this object expects.boolean
hasNext()
boolean
hasPrevious()
Checks to see if there is a previous element that can be iterated to.E
next()
int
nextIndex()
E
previous()
Gets the previous element from the container.int
previousIndex()
void
remove()
void
set(E obj)
-
-
-
Field Detail
-
next
private TreeList.AVLNode<E> next
Cache of the next node that will be returned bynext()
.
-
nextIndex
private int nextIndex
The index of the next node to be returned.
-
current
private TreeList.AVLNode<E> current
Cache of the last node that was returned bynext()
orprevious()
.
-
currentIndex
private int currentIndex
The index of the last node that was returned.
-
expectedModCount
private int expectedModCount
The 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.
-
-
Method Detail
-
checkModCount
protected void checkModCount()
Checks the modification count of the list is the value that this object expects.- Throws:
java.util.ConcurrentModificationException
- If the list's modification count isn't the value that was expected.
-
hasNext
public boolean hasNext()
-
next
public E 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 interfacejava.util.ListIterator<E>
- Specified by:
hasPrevious
in interfaceOrderedIterator<E>
- Returns:
true
if the iterator has a previous element
-
previous
public E previous()
Description copied from interface:OrderedIterator
Gets the previous element from the container.- Specified by:
previous
in interfacejava.util.ListIterator<E>
- Specified by:
previous
in interfaceOrderedIterator<E>
- Returns:
- the previous element in the iteration
-
nextIndex
public int nextIndex()
- Specified by:
nextIndex
in interfacejava.util.ListIterator<E>
-
previousIndex
public int previousIndex()
- Specified by:
previousIndex
in interfacejava.util.ListIterator<E>
-
remove
public void remove()
-
-