Package io.delta.kernel.utils
Interface CloseableIterable<T>
- Type Parameters:
T
- the type of elements returned by this iterator
- All Superinterfaces:
AutoCloseable
,Closeable
,Iterable<T>
Extend the Java
Iterable
interface to provide a way to close the iterator.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> CloseableIterable<T>
Return anCloseableIterable
object for an empty collection.default void
static <T> CloseableIterable<T>
inMemoryIterable
(CloseableIterator<T> iterator) Return anCloseableIterable
object that is backed by an in-memory collection of givenCloseableIterator
.iterator()
Overrides the default iterator method to return aCloseableIterator
.default Spliterator<T>
-
Method Details
-
iterator
CloseableIterator<T> iterator()Overrides the default iterator method to return aCloseableIterator
.- Specified by:
iterator
in interfaceIterable<T>
- Returns:
- a
CloseableIterator
instance.
-
forEach
-
spliterator
- Specified by:
spliterator
in interfaceIterable<T>
-
inMemoryIterable
Return anCloseableIterable
object that is backed by an in-memory collection of givenCloseableIterator
. Users should aware that the returnedCloseableIterable
will hold the data in memory.- Type Parameters:
T
- the type of elements returned by the iterator- Parameters:
iterator
- the iterator to be converted to aCloseableIterable
. It will be closed by this callee.- Returns:
- a
CloseableIterable
instance.
-
emptyIterable
Return anCloseableIterable
object for an empty collection.- Type Parameters:
T
- the type of elements returned by the iterator- Returns:
- a
CloseableIterable
instance.
-