Class AbstractPrimedIterator<E>
- java.lang.Object
-
- com.globalmentor.collections.iterators.AbstractPrimedIterator<E>
-
- Type Parameters:
E
- The type of element returned by the iterator.
- All Implemented Interfaces:
java.util.Iterator<E>
- Direct Known Subclasses:
AbstractFilteredIterator
public abstract class AbstractPrimedIterator<E> extends java.lang.Object implements java.util.Iterator<E>
Abstract implementation of an iterator that lazily primes its next value.This version does not support
remove()
.This class is not thread safe.
- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description AbstractPrimedIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
E
next()
protected abstract E
primeNext()
Returns the next available element for the iterator.void
remove()
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<E>
-
primeNext
protected abstract E primeNext()
Returns the next available element for the iterator. The value returned by this method will be returned by the next call tonext
. The implementation guarantees that this method will not be called again afternull
is returned.- Returns:
- The next primed value for the iterator, or
null
if there are no further values.
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<E>
-
-