T
- iterated type@Beta @PublicAPI public interface CloseableIterator<T> extends Iterator<T>, Closeable
IOException
potentially thrown from a delegate Closeable.close()
is expected to be wrapped in to an
IllegalStateException
.
For providing an implementation one can use CloseableIterators.wrap(java.util.Iterator)
,
CloseableIterators.wrap(java.util.Iterator, java.io.Closeable)
or .
Please note that this interface is marked with @Beta annotation, so it can be subject of incompatible changes or removal in later releases.
Modifier and Type | Method and Description |
---|---|
default void |
close() |
default <U> CloseableIterator<U> |
transform(Function<T,U> transformation)
Apply a transformation of the elements of this Iterator.
|
forEachRemaining, hasNext, next, remove
default void close() throws IllegalStateException
close
in interface AutoCloseable
close
in interface Closeable
IllegalStateException
default <U> CloseableIterator<U> transform(Function<T,U> transformation)
U
- Transformed typetransformation
- Transformation to apply on returned elements