|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mmm.util.collection.base.AbstractIterator<E>
E - is the generic type of the iterated elements.public abstract class AbstractIterator<E>
This is an abstract base implementation of the Iterator interface. It
allows to implement an read-only lookahead Iterator easier:
Simply extend this class and implement findNext(). From your
constructor or initializer call findFirst().
ATTENTION:
Do NOT forget to call findFirst() from your constructor or your
iterator will always be empty.
| Field Summary | |
|---|---|
private E |
next
the next item or null if done |
| Constructor Summary | |
|---|---|
AbstractIterator()
The constructor. |
|
| Method Summary | |
|---|---|
protected void |
findFirst()
This method has to be called from the constructor of the implementing class. |
protected abstract E |
findNext()
This method tries to find the next element. |
boolean |
hasNext()
|
E |
next()
|
void |
remove()
This method will always throw an exception. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private E next
null if done
| Constructor Detail |
|---|
public AbstractIterator()
findFirst()| Method Detail |
|---|
protected final void findFirst()
protected abstract E findNext()
next element.
null if done.public final boolean hasNext()
hasNext in interface Iterator<E>public final E next()
next in interface Iterator<E>
public final void remove()
throws UnsupportedOperationException
remove in interface Iterator<E>UnsupportedOperationException - whenever this method is called.Iterator.remove()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||