|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- type of the iterated objectspublic interface CloseableIterator<T>
An Iterator
that can (and must) be closed after it's not needed anymore.
This interface is used to implement Iterator
s that generate their elements lazily, e.g. from SQL
ResultSet
s. In order to be able to release the underlying resources (such as JDBC
Connection
s), an explicit notification is necessary which is provided by the close()
method.
Method Summary | |
---|---|
void |
close()
Frees all underlying resources, no other method calls are permitted after calling this. |
Collection<T> |
getAsCollectionAndClose(Collection<T> collection)
Copies the elements into the given Collection and closes the iterator. |
List<T> |
getAsListAndClose()
Returns the elements as an easy accessible List and closes the iterator. |
Methods inherited from interface java.util.Iterator |
---|
hasNext, next, remove |
Method Detail |
---|
void close()
List<T> getAsListAndClose()
List
and closes the iterator.
NOTE: This should only be used for small numbers of elements.
null
Collection<T> getAsCollectionAndClose(Collection<T> collection)
Collection
and closes the iterator.
collection
- collection where the elements are copied, must not be null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |