|
||||||||||
| 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 Iterators that generate their elements lazily, e.g. from SQL
ResultSets. In order to be able to release the underlying resources (such as JDBC
Connections), 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. |
java.util.Collection<T> |
getAsCollectionAndClose(java.util.Collection<T> collection)
Copies the elements into the given Collection and closes the iterator. |
java.util.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()
java.util.List<T> getAsListAndClose()
List and closes the iterator.
NOTE: This should only be used for small numbers of elements.
nulljava.util.Collection<T> getAsCollectionAndClose(java.util.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 | |||||||||