|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.collections.iterators.LoopingIterator<E>
public class LoopingIterator<E>
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 beenremoved.
Concurrent modifications are not directly supported, and for most collection
implementations will throw a ConcurrentModificationException.
| Constructor Summary | |
|---|---|
LoopingIterator(Collection<E> coll)
Constructor that wraps a collection. |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
Has the iterator any more elements. |
E |
next()
Returns the next object in the collection. |
void |
remove()
Removes the previously retrieved item from the underlying collection. |
void |
reset()
Resets the iterator back to the start of the collection. |
int |
size()
Gets the size of the collection underlying the iterator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LoopingIterator(Collection<E> coll)
coll - the collection to wrap
NullPointerException - if the collection is null| Method Detail |
|---|
public boolean hasNext()
removed.
hasNext in interface Iterator<E>true if there are more elementspublic E next()
next in interface Iterator<E>NoSuchElementException - if there are no elements
at all. Use hasNext() to avoid this error.public void remove()
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.
remove in interface Iterator<E>public void reset()
reset in interface ResettableIterator<E>public int size()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||