Class CachingIterable<T>
- java.lang.Object
-
- uk.gov.gchq.gaffer.commonutil.iterable.CachingIterable<T>
-
- Type Parameters:
T
- the type of the iterable.
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<T>
public class CachingIterable<T> extends Object implements Closeable, Iterable<T>
ACachingIterable
is aCloseable
Iterable
that attempts to cache the iterable the first time it is read. Subsequently, when iterator is called, an iterator to the cached iterable is returned. The caching is disabled if the iterable size is greater than a provided max size. By default this is 100,000.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_MAX_SIZE
-
Constructor Summary
Constructors Constructor Description CachingIterable(Iterable<T> iterable)
CachingIterable(Iterable<T> iterable, int maxSize)
-
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
-
-
-
-
Field Detail
-
DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_SIZE
- See Also:
- Constant Field Values
-
-