@Beta @PublicAPI public final class CloseableIterators extends java.lang.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,
com.google.common.base.Function<T,U> transformation)
Create a transformed view of a CloseableIterator.
|
static <T> CloseableIterator<T> |
wrap(java.util.Iterator<T> i)
Wrap an
Iterator into a CloseableIterator . |
static <T> CloseableIterator<T> |
wrap(java.util.Iterator<T> i,
java.io.Closeable c)
|
static <S extends java.io.Closeable,T> |
wrapTransformed(S source,
com.google.common.base.Function<? super S,java.util.Iterator<T>> transformation)
Make a CloseableIterator from an Iterator resulting from the transformation of a Closeable.
|
public static <S extends java.io.Closeable,T> CloseableIterator<T> wrapTransformed(S source, com.google.common.base.Function<? super S,java.util.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
- Transformationpublic static <T,U> CloseableIterator<U> transform(CloseableIterator<T> i, com.google.common.base.Function<T,U> transformation)
CloseableIterator.close()
related API contracts.T
- Iterated typeU
- Transformed typei
- Iterator to wraptransformation
- Transformation to applypublic static <T> CloseableIterator<T> wrap(java.util.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(java.util.Iterator<T> i, java.io.Closeable c)
T
- Iterated typei
- Iterator to wrapc
- Closeable to delegate