public interface CloseableWrappedIterable<T> extends CloseableIterable<T>, Closeable
CloseableIterator but also can be closed itself. This allows us to do something like this pattern:
CloseableWrappedIterable<Foo> wrapperIterable = fooDao.getCloseableIterable();
try {
for (Foo foo : wrapperIterable) {
...
}
} finally {
wrapperIterable.close();
}
| Modifier and Type | Method and Description |
|---|---|
void |
close()
This will close the last iterator returned by the
Iterable.iterator() method. |
closeableIteratorforEach, iterator, spliteratorvoid close()
throws IOException
Iterable.iterator() method.close in interface AutoCloseableclose in interface CloseableIOExceptionThis documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.