E - public abstract class AbstractIterator<E>
extends java.lang.Object
implements java.util.Iterator<E>
| Constructor and Description |
|---|
AbstractIterator() |
| Modifier and Type | Method and Description |
|---|---|
protected E |
done()
Call when done.
|
protected abstract E |
fetch()
Fetch next element.
|
boolean |
hasNext() |
E |
next() |
void |
release()
Returns the iterator back to its associated pool, if any.
|
void |
remove()
Default implementation throws
UnsupportedOperationException. |
public boolean hasNext()
hasNext in interface java.util.Iterator<E>public void remove()
UnsupportedOperationException.remove in interface java.util.Iterator<E>protected abstract E fetch()
done() when all elements have been
fetched.protected final E done()
public final void release()
Iterator obtained by explicitNote it is always safe to call release() whatever the iterator has already been effectively released or not. Of course, using the iterator after a release() is always a logical error, since such object is supposed to be "freed".Iterable.iterator() or any other factory-like interface, then later implied in an incomplete iteration loop, i.e whereIterator.hasNext() has never returned false.
Copyright © 2017. All rights reserved.