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 anCloseableIterableobject for an empty collection.default voidstatic <T> CloseableIterable<T>inMemoryIterable(CloseableIterator<T> iterator) Return anCloseableIterableobject 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:
iteratorin interfaceIterable<T>- Returns:
- a
CloseableIteratorinstance.
-
forEach
-
spliterator
- Specified by:
spliteratorin interfaceIterable<T>
-
inMemoryIterable
Return anCloseableIterableobject that is backed by an in-memory collection of givenCloseableIterator. Users should aware that the returnedCloseableIterablewill 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
CloseableIterableinstance.
-
emptyIterable
Return anCloseableIterableobject for an empty collection.- Type Parameters:
T- the type of elements returned by the iterator- Returns:
- a
CloseableIterableinstance.
-