Class TreeList.TreeListIterator
- java.lang.Object
-
- org.apache.commons.collections.list.TreeList.TreeListIterator
-
- All Implemented Interfaces:
java.util.Iterator
,java.util.ListIterator
,OrderedIterator
- Enclosing class:
- TreeList
static class TreeList.TreeListIterator extends java.lang.Object implements java.util.ListIterator, OrderedIterator
A list iterator over the linked list.
-
-
Field Summary
Fields Modifier and Type Field Description protected TreeList.AVLNode
current
Cache of the last node that was returned bynext()
orprevious()
.protected int
currentIndex
The index of the last node that was returned.protected int
expectedModCount
The modification count that the list is expected to have.protected TreeList.AVLNode
next
Cache of the next node that will be returned bynext()
.protected int
nextIndex
The index of the next node to be returned.protected TreeList
parent
The parent list
-
Constructor Summary
Constructors Modifier Constructor Description protected
TreeListIterator(TreeList parent, int fromIndex)
Create a ListIterator for a list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.Object 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.java.lang.Object
next()
int
nextIndex()
java.lang.Object
previous()
Gets the previous element from the collection.int
previousIndex()
void
remove()
void
set(java.lang.Object obj)
-
-
-
Field Detail
-
parent
protected final TreeList parent
The parent list
-
next
protected TreeList.AVLNode next
Cache of the next node that will be returned bynext()
.
-
nextIndex
protected int nextIndex
The index of the next node to be returned.
-
current
protected TreeList.AVLNode current
Cache of the last node that was returned bynext()
orprevious()
.
-
currentIndex
protected int currentIndex
The index of the last node that was returned.
-
expectedModCount
protected 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.
-
-
Constructor Detail
-
TreeListIterator
protected TreeListIterator(TreeList parent, int fromIndex) throws java.lang.IndexOutOfBoundsException
Create a ListIterator for a list.- Parameters:
parent
- the parent listfromIndex
- the index to start at- Throws:
java.lang.IndexOutOfBoundsException
-
-
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()
- Specified by:
hasNext
in interfacejava.util.Iterator
- Specified by:
hasNext
in interfacejava.util.ListIterator
-
next
public java.lang.Object next()
- Specified by:
next
in interfacejava.util.Iterator
- Specified by:
next
in interfacejava.util.ListIterator
-
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
- Specified by:
hasPrevious
in interfaceOrderedIterator
- Returns:
true
if the iterator has a previous element
-
previous
public java.lang.Object previous()
Description copied from interface:OrderedIterator
Gets the previous element from the collection.- Specified by:
previous
in interfacejava.util.ListIterator
- Specified by:
previous
in interfaceOrderedIterator
- Returns:
- the previous element in the iteration
-
nextIndex
public int nextIndex()
- Specified by:
nextIndex
in interfacejava.util.ListIterator
-
previousIndex
public int previousIndex()
- Specified by:
previousIndex
in interfacejava.util.ListIterator
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator
- Specified by:
remove
in interfacejava.util.ListIterator
-
set
public void set(java.lang.Object obj)
- Specified by:
set
in interfacejava.util.ListIterator
-
add
public void add(java.lang.Object obj)
- Specified by:
add
in interfacejava.util.ListIterator
-
-