Class SuppliedIterable<T>

  • Type Parameters:
    T - the type of the iterable.
    All Implemented Interfaces:
    Closeable, AutoCloseable, Iterable<T>

    public class SuppliedIterable<T>
    extends Object
    implements Closeable, Iterable<T>

    A SuppliedIterable allows a Closeable Iterable that can normally only be consumed once, be consumed multiple times. This SuppliedIterable is constructed with an Iterable Supplier. When a new iterator is requested the get method is invoked on the supplier to generate a new iterable.

    This iterable is a Closeable Iterable so it will close the supplier's iterables when finished. However, if it is referred to as just an Iterable then the CloseableUtil will have to be called to ensure that it is closed safely.