java.lang.Object
io.github.mmm.base.collection.AbstractIterator<E>
- Type Parameters:
E- type of the elements toiterate.
- All Implemented Interfaces:
Iterator<E>
Abstract base implementation of
Iterator as reusable pattern to simplify implementations of Iterator.
Please carefully consider the following constraints before use:
- This
Iteratorcannot iteratenullelements. - Implementations extending
AbstractIteratorhave to callfindFirst()at the end of their constructor. - Finally, you only to do implement
findNext().
-
Constructor Details
-
AbstractIterator
public AbstractIterator()
-
-
Method Details
-
findFirst
protected final void findFirst()Has to be called from the constructor after initialization of fields to find the first element. -
findNext
- Returns:
- the next element or
nullif done.
-
hasNext
public final boolean hasNext() -
next
-
toString
-