|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ClosableIterator<T>
An iterator which should be closed after use. Some iterators take up resources which should be free'd as soon as possible, eg large structures which can be discarded early, or external resources such as database cursors.
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 documention 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.
Method Summary | |
---|---|
void |
close()
Close the iterator. |
Methods inherited from interface java.util.Iterator |
---|
hasNext, next, remove |
Method Detail |
---|
void close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |