Package org.apache.commons.rdfrdf4j
Interface ClosableIterable<T>
- Type Parameters:
T
- type of elements returned by the iterator
- All Superinterfaces:
AutoCloseable
,Iterable<T>
An
Iterable
which should be AutoCloseable.close()
d after use.
A good pattern to use this iterator is with an outer try-with-resources
block:
for (ClosableIterable<Triple> triples : graph.iterate()) {
for (Triple t : triples) {
return t; // OK to terminate for-loop early
}
}
The above will ensure that underlying resources are closed even if
the iteration does not exhaust all triples.
-
Method Summary
Methods inherited from interface java.lang.AutoCloseable
close
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator