Package no.digipost.collection
Class SimpleIterator<T>
- java.lang.Object
-
- no.digipost.collection.SimpleIterator<T>
-
- Type Parameters:
T- The type of elements yielded by this iterator.
- All Implemented Interfaces:
Iterator<T>
public abstract class SimpleIterator<T> extends Object implements Iterator<T>
SimpleIterator offers an easier way to implement theIteratorinterface, by requiring only one method,nextIfAvailable(), to be implemented instead of bothhasNext()andnext(). In addition, implementations are free to throw any exception, which, if is a checked exception, will be rethrown wrapped in aRuntimeException.- See Also:
nextIfAvailable()
-
-
Constructor Summary
Constructors Constructor Description SimpleIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Tnext()protected abstract Optional<? extends T>nextIfAvailable()voidremove()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-