Interface CloseableIterable<E>

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable, java.lang.Iterable<E>

    public interface CloseableIterable<E>
    extends java.io.Closeable, java.lang.Iterable<E>
    This Iterable exists for the purpose of being able to iterate over a list of indeterminate size (possibly too large for memory), while still guaranteeing that whatever resource is being held (like a Stream) will be closed when iteration finishes (or it goes out of scope).
    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static <E> CloseableIterable<E> ensureCloseable​(java.lang.Iterable<E> iter)  
      • Methods inherited from interface java.io.Closeable

        close
      • Methods inherited from interface java.lang.Iterable

        forEach, iterator, spliterator
    • Method Detail

      • ensureCloseable

        static <E> CloseableIterable<E> ensureCloseable​(java.lang.Iterable<E> iter)