Class SuppliedIterable<T>
- java.lang.Object
-
- uk.gov.gchq.gaffer.commonutil.iterable.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 aCloseable
Iterable
that can normally only be consumed once, be consumed multiple times. This SuppliedIterable is constructed with anIterable
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 anIterable
then theCloseableUtil
will have to be called to ensure that it is closed safely.
-
-
Constructor Summary
Constructors Constructor Description SuppliedIterable(Supplier<? extends Iterable<T>> supplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Iterator<T>
iterator()
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-