Interface ClosableIterable<T>

  • Type Parameters:
    T - type of elements returned by the iterator
    All Superinterfaces:
    java.lang.AutoCloseable, java.lang.Iterable<T>
    All Known Implementing Classes:
    ConvertedStatements

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

    • Method Summary

      • Methods inherited from interface java.lang.AutoCloseable

        close
      • Methods inherited from interface java.lang.Iterable

        forEach, iterator, spliterator