Class AbstractIterator<T>
- java.lang.Object
-
- org.eclipse.net4j.util.collection.AbstractIterator<T>
-
- All Implemented Interfaces:
java.util.Iterator<T>
- Direct Known Subclasses:
AbstractCloseableIterator
,AbstractFilteredIterator
,AbstractListIterator
,ComposedIterator
public abstract class AbstractIterator<T> extends java.lang.Object implements java.util.Iterator<T>
An abstract base class for custom iterators that only requires to implement a singlecomputeNextElement()
method.- Since:
- 3.2
- Author:
- Eike Stepper
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.Object
END_OF_DATA
The token to be used incomputeNextElement()
to indicate the end of the iteration.
-
Constructor Summary
Constructors Constructor Description AbstractIterator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.lang.Object
computeNextElement()
Returns the next iteration element, orEND_OF_DATA
if the end of the iteration has been reached.static <T> java.util.ListIterator<T>
empty()
boolean
hasNext()
T
next()
void
remove()
-
-
-
Field Detail
-
END_OF_DATA
protected static final java.lang.Object END_OF_DATA
The token to be used incomputeNextElement()
to indicate the end of the iteration.
-
-
Method Detail
-
hasNext
public final boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<T>
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<T>
-
computeNextElement
protected abstract java.lang.Object computeNextElement()
Returns the next iteration element, orEND_OF_DATA
if the end of the iteration has been reached.
-
empty
public static <T> java.util.ListIterator<T> empty()
- Since:
- 3.4
-
-