public interface CloseableIterator<T> extends Iterator<T>, AutoCloseable
Modifier and Type | Interface and Description |
---|---|
static class |
CloseableIterator.AbstractCloseableIterator<T> |
static class |
CloseableIterator.DelegatingCloseableIterator<T> |
static class |
CloseableIterator.EmptyCloseableIterator<T> |
Modifier and Type | Method and Description |
---|---|
void |
close() |
static <T> CloseableIterator<T> |
closeAfterLast(CloseableIterator<T> theIterator,
Runnable theRunnable) |
static void |
closeQuietly(Iterator<?> theIterator) |
static <T,A,R> R |
collect(CloseableIterator<T> theIter,
Collector<T,A,R> theCollector)
Collect the contents of the iterator.
|
static <I> CloseableIterator<I> |
concat(CloseableIterator<I> theFirst,
CloseableIterator<I> theSecond) |
static <T> CloseableIterator<T> |
concat(Iterable<? extends CloseableIterator<T>> theIters) |
static <T> CloseableIterator<T> |
concat(Iterator<? extends CloseableIterator<T>> inputs) |
static <T> CloseableIterator<T> |
empty() |
static <T> CloseableIterator<T> |
filter(CloseableIterator<T> theIter,
Predicate<T> thePredicate) |
static <T> Optional<T> |
first(CloseableIterator<T> theIter)
Get the first element in the iterator.
|
static boolean |
isEmpty(CloseableIterator<?> theIterator) |
static <T> CloseableIterator<T> |
limit(CloseableIterator<T> theIter,
long theLimit) |
static <I,O> CloseableIterator<O> |
map(CloseableIterator<I> theIterator,
Function<? super I,O> theFunction) |
static <T> CloseableIterator<T> |
offset(CloseableIterator<T> theIter,
long theOffset) |
static <T> CloseableIterator<T> |
onClose(CloseableIterator<T> theIter,
Runnable theRunnable) |
static <T> CloseableIterator<T> |
singleton(T theElem) |
static <T> long |
size(CloseableIterator<T> theIter)
Return the number of elements in the iterator.
|
static <T> CloseableIterator<T> |
toCloseable(Iterator<? extends T> theIterator) |
static <T> CloseableIterator<T> |
toCloseable(Iterator<? extends T> theIterator,
Runnable theOnClose) |
static <T> CloseableIterator<T> |
toCloseable(Stream<T> theStream) |
static <T> List<T> |
toList(CloseableIterator<T> theIter)
Collect the contents of the iterator as a
List . |
static <T> Set<T> |
toSet(CloseableIterator<T> theIter)
Collect the contents of the iterator as a
Set . |
static <In,Out> CloseableIterator<Out> |
transform(CloseableIterator<In> theIter,
Function<In,Out> theFunction) |
forEachRemaining, hasNext, next, remove
void close() throws RuntimeException
close
in interface AutoCloseable
RuntimeException
@MustBeClosed static <T> CloseableIterator<T> onClose(CloseableIterator<T> theIter, Runnable theRunnable)
static <T> CloseableIterator<T> closeAfterLast(CloseableIterator<T> theIterator, Runnable theRunnable)
static void closeQuietly(Iterator<?> theIterator)
static <T> CloseableIterator<T> empty()
static <T> CloseableIterator<T> singleton(T theElem)
@MustBeClosed static <T> CloseableIterator<T> concat(Iterable<? extends CloseableIterator<T>> theIters)
static <T> CloseableIterator<T> concat(Iterator<? extends CloseableIterator<T>> inputs)
static <T> Optional<T> first(CloseableIterator<T> theIter)
theIter
- the iteratorstatic <T> Set<T> toSet(CloseableIterator<T> theIter)
Set
. The iterator is closed after collection.theIter
- the iteratorstatic <T> List<T> toList(CloseableIterator<T> theIter)
List
. The iterator is closed after collection.theIter
- the iteratorstatic <T,A,R> R collect(CloseableIterator<T> theIter, Collector<T,A,R> theCollector)
theIter
- the iterator whose contents should be collectedtheCollector
- the colectorstatic <T> long size(CloseableIterator<T> theIter)
theIter
- the iterator@MustBeClosed static <T> CloseableIterator<T> offset(CloseableIterator<T> theIter, long theOffset)
@MustBeClosed static <T> CloseableIterator<T> limit(CloseableIterator<T> theIter, long theLimit)
@MustBeClosed static <T> CloseableIterator<T> filter(CloseableIterator<T> theIter, Predicate<T> thePredicate)
@MustBeClosed static <In,Out> CloseableIterator<Out> transform(CloseableIterator<In> theIter, Function<In,Out> theFunction)
@MustBeClosed static <T> CloseableIterator<T> toCloseable(Stream<T> theStream)
static <T> CloseableIterator<T> toCloseable(Iterator<? extends T> theIterator)
@MustBeClosed static <T> CloseableIterator<T> toCloseable(Iterator<? extends T> theIterator, Runnable theOnClose)
static boolean isEmpty(CloseableIterator<?> theIterator)
static <I,O> CloseableIterator<O> map(CloseableIterator<I> theIterator, Function<? super I,O> theFunction)
static <I> CloseableIterator<I> concat(CloseableIterator<I> theFirst, CloseableIterator<I> theSecond)
Copyright © 2010-2016 Stardog Union. All Rights Reserved.