Interface ClosableIterable<T>

Type Parameters:
T - type of elements returned by the iterator
All Superinterfaces:
AutoCloseable, Iterable<T>

public interface ClosableIterable<T> extends Iterable<T>, AutoCloseable
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.