public interface CloseableIterator<E> extends Iterator<E>, AutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
close()
You MUST close this iterator or auto-close with a try-with-resources.
|
default List<E> |
collect()
Collect the elements into a list.
|
default long |
count()
Count the elements.
|
default long |
countDistinct()
Count the distinct elements.
|
static <T> CloseableIterator<T> |
emptyIterator()
Empty instance.
|
default void |
forEachRemaining(Consumer<? super E> action)
Perform some action on each remaining element and then close the itertor.
|
static <T> CloseableIterator<T> |
of(Iterator<T> it,
Runnable onClose)
Construct an instance from the supplied iterator and the supplied
onClose behavior.
|
static <T> CloseableIterator<T> |
of(Stream<T> stream)
Construct an instance from a stream using stream.close() as the close
behavior for the iterator.
|
default Stream<E> |
stream()
You MUST close this stream or auto-close in a try-with-resources.
|
void close()
close
in interface AutoCloseable
default void forEachRemaining(Consumer<? super E> action)
forEachRemaining
in interface Iterator<E>
default long count()
default long countDistinct()
static <T> CloseableIterator<T> of(Stream<T> stream)
static <T> CloseableIterator<T> of(Iterator<T> it, Runnable onClose)
static <T> CloseableIterator<T> emptyIterator()
Copyright © 2015–2016 SYSTAP, LLC DBA Blazegraph. All rights reserved.