@Beta @PublicAPI public final class CloseableIterators extends Object
Please note that this class is marked with @Beta annotation, so it can be subject of incompatible changes or removal in later releases.
Modifier and Type | Method and Description |
---|---|
static <T,U> CloseableIterator<U> |
transform(CloseableIterator<T> i,
Function<T,U> transformation)
Deprecated.
CloseableIterator.transform(java.util.function.Function) provides default method making this
utility not necessary |
static <T> CloseableIterator<T> |
wrap(Iterator<T> i)
Wrap an
Iterator into a CloseableIterator . |
static <T> CloseableIterator<T> |
wrap(Iterator<T> i,
Closeable c)
|
static <S extends Closeable,T> |
wrapTransformed(S source,
Function<? super S,Iterator<T>> transformation)
Make a CloseableIterator from an Iterator resulting from the transformation of a Closeable.
|
public static <S extends Closeable,T> CloseableIterator<T> wrapTransformed(S source, Function<? super S,Iterator<T>> transformation)
S
- Type of source which is Closeable and will be transformed into an IteratorT
- Type of iterated item created by the transformed Iteratorsource
- Source to transform and to closetransformation
- Transformation@Deprecated public static <T,U> CloseableIterator<U> transform(CloseableIterator<T> i, Function<T,U> transformation)
CloseableIterator.transform(java.util.function.Function)
provides default method making this
utility not necessaryCloseableIterator.close()
related API contracts.T
- Iterated typeU
- Transformed typei
- Iterator to wraptransformation
- Transformation to applypublic static <T> CloseableIterator<T> wrap(Iterator<T> i)
Iterator
into a CloseableIterator
.
The returned instances enforce CloseableIterator.close()
related API contracts.T
- Iterated typei
- Iterator to wrappublic static <T> CloseableIterator<T> wrap(Iterator<T> i, Closeable c)
T
- Iterated typei
- Iterator to wrapc
- Closeable to delegate