java.lang.Object | |
↳ | org.apache.commons.collections.iterators.LoopingIterator |
An Iterator that restarts when it reaches the end.
The iterator will loop continuously around the provided elements, unless
there are no elements in the collection to begin with, or all the elements
have been removed
.
Concurrent modifications are not directly supported, and for most collection implementations will throw a ConcurrentModificationException.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor that wraps a collection.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Has the iterator any more elements.
| |||||||||||
Returns the next object in the collection.
| |||||||||||
Removes the previously retrieved item from the underlying collection.
| |||||||||||
Resets the iterator back to the start of the collection.
| |||||||||||
Gets the size of the collection underlying the iterator.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.util.Iterator
| |||||||||||
From interface
org.apache.commons.collections.ResettableIterator
|
Constructor that wraps a collection.
There is no way to reset an Iterator instance without recreating it from the original source, so the Collection must be passed in.
coll | the collection to wrap |
---|
NullPointerException | if the collection is null |
---|
Has the iterator any more elements.
Returns false only if the collection originally had zero elements, or
all the elements have been removed
.
true
if there are more elements
Returns the next object in the collection.
If at the end of the collection, return the first element.
NoSuchElementException | if there are no elements
at all. Use hasNext() to avoid this error.
|
---|
Removes the previously retrieved item from the underlying collection.
This feature is only supported if the underlying collection's
iterator
method returns an implementation
that supports it.
This method can only be called after at least one next()
method call.
After a removal, the remove method may not be called again until another
next has been performed. If the reset()
is called, then remove may
not be called until next()
is called again.
Resets the iterator back to the start of the collection.
Gets the size of the collection underlying the iterator.