com.hp.hpl.jena.util.iterator
Interface ClosableIterator<T>

All Superinterfaces:
java.util.Iterator<T>
All Known Subinterfaces:
ExtendedIterator<T>, NodeIterator, NsIterator, ResIterator, RSIterator, StmtIterator, TripleIterator
All Known Implementing Classes:
EarlyBindingIterator, FilterDropIterator, FilterIterator, FilterKeepIterator, LazyIterator, Map1Iterator, MapFilterIterator, NiceIterator, NullIterator, RandomOrderIterator, SingletonIterator, TripleMatchIterator, UniqueExtendedIterator, WrappedIterator

public interface ClosableIterator<T>
extends java.util.Iterator<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.

Version:
$Id: ClosableIterator.java,v 1.2 2009/09/28 13:47:59 chris-dollin Exp $
Author:
bwm

Method Summary
 void close()
          Close the iterator.
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Method Detail

close

void close()
Close the iterator. Other operations on this iterator may now throw an exception. A ClosableIterator may be closed as many times as desired - the subsequent calls do nothing.



Copyright ? 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP