Package com.chemaxon.calculations.io
Class CloseableIterators
- java.lang.Object
-
- com.chemaxon.calculations.io.CloseableIterators
-
@Beta @PublicAPI public final class CloseableIterators extends Object
Utility class.Please note that this class is marked with @Beta annotation, so it can be subject of incompatible changes or removal in later releases.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method 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 necessarystatic <T> CloseableIterator<T>
wrap(Iterator<T> i)
Wrap anIterator
into aCloseableIterator
.static <T> CloseableIterator<T>
wrap(Iterator<T> i, Closeable c)
static <S extends Closeable,T>
CloseableIterator<T>wrapTransformed(S source, Function<? super S,Iterator<T>> transformation)
Make a CloseableIterator from an Iterator resulting from the transformation of a Closeable.
-
-
-
Method Detail
-
wrapTransformed
public static <S extends Closeable,T> CloseableIterator<T> wrapTransformed(S source, Function<? super S,Iterator<T>> transformation)
Make a CloseableIterator from an Iterator resulting from the transformation of a Closeable.- Type Parameters:
S
- Type of source which is Closeable and will be transformed into an IteratorT
- Type of iterated item created by the transformed Iterator- Parameters:
source
- Source to transform and to closetransformation
- Transformation- Returns:
- Result
-
transform
@Deprecated public 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 necessaryCreate a transformed view of a CloseableIterator. The returned instances enforceCloseableIterator.close()
related API contracts.- Type Parameters:
T
- Iterated typeU
- Transformed type- Parameters:
i
- Iterator to wraptransformation
- Transformation to apply- Returns:
- Transformed view
-
wrap
public static <T> CloseableIterator<T> wrap(Iterator<T> i)
Wrap anIterator
into aCloseableIterator
. The returned instances enforceCloseableIterator.close()
related API contracts.- Type Parameters:
T
- Iterated type- Parameters:
i
- Iterator to wrap- Returns:
- Wrapped instance
-
wrap
public static <T> CloseableIterator<T> wrap(Iterator<T> i, Closeable c)
- Type Parameters:
T
- Iterated type- Parameters:
i
- Iterator to wrapc
- Closeable to delegate- Returns:
- Composite
-
-