java.lang.Object | |
↳ | org.apache.commons.collections.iterators.ListIteratorWrapper |
Converts an iterator into a list iterator by caching the returned entries.
The ListIterator
interface has additional useful methods
for navigation - previous()
and the index methods.
This class allows a regular Iterator
to behave as a
ListIterator
. It achieves this by building a list internally
of as the underlying iterator is traversed.
The optional operations of ListIterator
are not supported.
This class implements ResettableListIterator from Commons Collections 3.2.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new
ListIteratorWrapper that will wrap
the given iterator. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Throws
UnsupportedOperationException . | |||||||||||
Returns true if there are more elements in the iterator.
| |||||||||||
Returns true if there are previous elements in the iterator.
| |||||||||||
Returns the next element from the iterator.
| |||||||||||
Returns in the index of the next element.
| |||||||||||
Returns the the previous element.
| |||||||||||
Returns the index of the previous element.
| |||||||||||
Throws
UnsupportedOperationException . | |||||||||||
Resets this iterator back to the position at which the iterator
was created.
| |||||||||||
Throws
UnsupportedOperationException . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.util.Iterator
| |||||||||||
From interface
java.util.ListIterator
| |||||||||||
From interface
org.apache.commons.collections.ResettableIterator
| |||||||||||
From interface
org.apache.commons.collections.ResettableListIterator
|
Constructs a new ListIteratorWrapper
that will wrap
the given iterator.
iterator | the iterator to wrap |
---|
NullPointerException | if the iterator is null |
---|
Throws UnsupportedOperationException
.
obj | the object to add, ignored |
---|
UnsupportedOperationException | always |
---|
Returns true if there are more elements in the iterator.
Returns true if there are previous elements in the iterator.
Returns the next element from the iterator.
NoSuchElementException | if there are no more elements |
---|
Returns in the index of the next element.
Returns the the previous element.
NoSuchElementException | if there are no previous elements |
---|
Returns the index of the previous element.
Throws UnsupportedOperationException
.
UnsupportedOperationException | always |
---|
Resets this iterator back to the position at which the iterator was created.
Throws UnsupportedOperationException
.
obj | the object to set, ignored |
---|
UnsupportedOperationException | always |
---|