public interface ClosableIterator<T> extends Iterator<T>
Users of ClosableIterators (and thus of ExtendedIterator) should close the iterator if they are done with it before it is exhausted (ie hasNext() is still true).If they do not, resources may leak or be reclaimed unpredictably or much later than convenient. It is unnecessary but harmless to close the iterator once it has become exhausted. [note: previous versions of this documentation specified a close regardless of exhaustion, but this was never the contract applied internally.]
Implementors are encouraged to dispose of resources as soon as is convenient.
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the iterator.
|
forEachRemaining, hasNext, next, remove
Licenced under the Apache License, Version 2.0