T
- public abstract class AbstractCloseableIterator<T> extends java.lang.Object implements CloseableIterator<T>
CloseableIterator
.
Does not support null
elements.
Subclasses must implement the computeNext()
method.
Subclasses may implement the closeOnlyOnce()
method.Constructor and Description |
---|
AbstractCloseableIterator() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Calls
closeOnlyOnce() only if the iterator has not already been closed. |
boolean |
hasNext()
Returns
true if the iteration has more elements. |
T |
next()
Returns the next element in the iteration.
|
void |
remove()
Throws
UnsupportedOperationException . |
public boolean hasNext()
true
if the iteration has more elements. Will call close()
if there are no more elements.hasNext
in interface java.util.Iterator<T>
public T next()
NoSuchElementException
if the iteration has no more elements.
Will call close()
if there are no more elements.next
in interface java.util.Iterator<T>
public void remove()
UnsupportedOperationException
.remove
in interface java.util.Iterator<T>
public void close()
closeOnlyOnce()
only if the iterator has not already been closed.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface CloseableIterator<T>