public interface CloseableIterable<T>
extends java.lang.Iterable<T>, java.io.Closeable
| Modifier and Type | Interface and Description |
|---|---|
static class |
CloseableIterable.ConcatCloseableIterable<E> |
| Modifier and Type | Method and Description |
|---|---|
static <E> CloseableIterable<E> |
combine(java.lang.Iterable<E> iterable,
java.io.Closeable closeable) |
static <E> CloseableIterable<E> |
concat(java.lang.Iterable<CloseableIterable<E>> iterable) |
static <T> CloseableIterable<T> |
count(Counter counter,
CloseableIterable<T> iterable)
Counts the number of elements in the given
CloseableIterable by incrementing the Counter instance for each Iterator.next() call. |
static <E> CloseableIterable<E> |
empty() |
static <E> CloseableIterable<E> |
filter(CloseableIterable<E> iterable,
java.util.function.Predicate<E> pred) |
static <E> CloseableIterable<E> |
filter(Counter skipCounter,
CloseableIterable<E> iterable,
java.util.function.Predicate<E> pred)
Filters the given
CloseableIterable and counts the number of elements that do not match
the predicate by incrementing the Counter. |
CloseableIterator<T> |
iterator()
Returns a closeable iterator over elements of type
T. |
static <I,O> CloseableIterable<O> |
transform(CloseableIterable<I> iterable,
java.util.function.Function<I,O> transform) |
static <E> CloseableIterable<E> |
whenComplete(CloseableIterable<E> iterable,
java.lang.Runnable onCompletionRunnable)
Will run the given runnable when
Closeable.close() has been called. |
static <E> CloseableIterable<E> |
withNoopClose(E entry) |
static <E> CloseableIterable<E> |
withNoopClose(java.lang.Iterable<E> iterable) |
CloseableIterator<T> iterator()
T.iterator in interface java.lang.Iterable<T>CloseableIterator.static <E> CloseableIterable<E> withNoopClose(E entry)
static <E> CloseableIterable<E> withNoopClose(java.lang.Iterable<E> iterable)
static <E> CloseableIterable<E> empty()
static <E> CloseableIterable<E> combine(java.lang.Iterable<E> iterable, java.io.Closeable closeable)
static <E> CloseableIterable<E> whenComplete(CloseableIterable<E> iterable, java.lang.Runnable onCompletionRunnable)
Closeable.close() has been called.E - The type of the underlying iterableiterable - The underlying CloseableIterable to iterate overonCompletionRunnable - The runnable to run after the underlying iterable was closedCloseableIterable where the runnable will be executed as the final step
after Closeable.close() has been calledstatic <E> CloseableIterable<E> filter(CloseableIterable<E> iterable, java.util.function.Predicate<E> pred)
static <E> CloseableIterable<E> filter(Counter skipCounter, CloseableIterable<E> iterable, java.util.function.Predicate<E> pred)
CloseableIterable and counts the number of elements that do not match
the predicate by incrementing the Counter.E - The underlying type to be iterated.skipCounter - The Counter instance to increment on each skipped item during
filtering.iterable - The underlying CloseableIterable to filter.CloseableIterable where the given skipCounter is incremented
whenever the predicate does not match.static <T> CloseableIterable<T> count(Counter counter, CloseableIterable<T> iterable)
CloseableIterable by incrementing the Counter instance for each Iterator.next() call.T - The underlying type to be iterated.counter - The Counter instance to increment on each Iterator.next() call.iterable - The underlying CloseableIterable to countCloseableIterable that increments the given counter on each Iterator.next() call.static <I,O> CloseableIterable<O> transform(CloseableIterable<I> iterable, java.util.function.Function<I,O> transform)
static <E> CloseableIterable<E> concat(java.lang.Iterable<CloseableIterable<E>> iterable)