T - type of source enumerated elements.E - type of enumerated elements.final class PipeEnumerable<T,E> extends AbstractEnumerable<E>
Enumerable that support high compositionality.Enumerable,
AbstractEnumerable| Modifier | Constructor and Description |
|---|---|
protected |
PipeEnumerable(Iterable<T> source,
Function<Enumerator<E>,Enumerator<T>> operator,
Supplier<Boolean> onceOnly)
Constructs a
PipeEnumerable using a regular Iterable
as a link. |
protected |
PipeEnumerable(PipeEnumerable<?,T> source,
Function<Enumerator<E>,Enumerator<T>> operator,
Supplier<Boolean> onceOnly)
Constructs a
PipeEnumerable using a Enumerable as a link. |
| Modifier and Type | Method and Description |
|---|---|
static <E> Enumerable<E> |
concat(Enumerable<E> enumerable,
Iterable<? extends E> elements)
Concatenates the given
elements to the given enumerable. |
static <E> Enumerable<E> |
distinct(Enumerable<E> enumerable)
Returns an
Enumerable that has the same elements as the given
enumerable but with duplicates removed. |
static <E> Enumerable<E> |
filter(Enumerable<E> enumerable,
Predicate<? super E> predicate)
Returns an
Enumerable that has the elements of the given
enumerable that pass the given predicate. |
static <E,R> Enumerable<R> |
flatMap(Enumerable<E> enumerable,
Function<? super E,? extends Iterable<? extends R>> mapper)
Returns an
Enumerable that replaces the elements of the given
enumerable with the elements of the Iterable obtained
by applying the given mapper on the each element. |
protected Enumerator<E> |
internalEnumerator()
Yields a new
Enumerator for the current Enumerable. |
protected boolean |
internalOnceOnly()
Gets whether the current instance may yield a
Enumerator
only once. |
static <E> Enumerable<E> |
limit(Enumerable<E> enumerable,
long maxSize)
Returns an
Enumerable that limits the elements of the given
enumerable to the given limit. |
static <E> Enumerable<E> |
limitWhile(Enumerable<E> enumerable,
Predicate<? super E> predicate)
Returns an
Enumerable that limits the elements of the given
enumerable while the given predicate holds true when
applied on the elements of the given enumerable. |
static <E,R> Enumerable<R> |
map(Enumerable<E> enumerable,
BiFunction<? super E,? super Long,? extends R> mapper)
Returns an
Enumerable that maps the elements of the given
enumerable to the values mapped by mapper applied on
each element and its index. |
static <E,R> Enumerable<R> |
map(Enumerable<E> enumerable,
Function<? super E,? extends R> mapper)
Returns an
Enumerable that maps the elements of the given
enumerable to the values mapped by mapper applied on
each element and its index. |
static <T,E> PipeEnumerable<T,E> |
of(Iterable<? extends T> source,
Function<Enumerator<E>,Enumerator<T>> operator,
Supplier<Boolean> onceOnly)
Creates a
PipeEnumerable instance with the given source,
operator and once only flag. |
static <E> Enumerable<E> |
peek(Enumerable<E> enumerable,
Consumer<? super E> action)
Returns an
Enumerable that peeks the elements of the given
enumerable, applies the given action on each of them
and then returns the elements unchanged. |
static <E> Enumerable<E> |
skip(Enumerable<E> enumerable,
long n)
Returns an
Enumerable that skips n times over the
elements of the given enumerable. |
static <E> Enumerable<E> |
skipWhile(Enumerable<E> enumerable,
Predicate<? super E> predicate)
Returns an
Enumerable that skips the elements of the given
enumerable while the given predicate holds true. |
static <E> Enumerable<E> |
takeWhile(Enumerable<E> enumerable,
Predicate<? super E> predicate)
Returns an
Enumerable that limits the elements of the given
enumerable while the given predicate holds true when
applied on the elements of the given enumerable. |
static <E> Enumerable<Optional<E>[]> |
zipAll(Enumerable<E> enumerable,
Iterable<? extends E> first,
Iterable<? extends E>... rest)
Returns an
Enumerable that zips the elements of the given
enumerable with the elements of the first
Iterable and the elements of the rest of the given
Iterable instances. |
enumerating, enumerator, onceOnlyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitappend, as, asEnumeration, asFiltered, asSpliterator, asStream, asTolerant, asTolerant, cached, cached, choiceOf, choiceOf, concat, concatOn, distinct, elementsEqual, empty, filter, flatMap, iterate, iterator, limit, limitWhile, map, map, of, of, of, of, of, of, ofLateBinding, ofLazyEnumeration, ofLazyIterable, ofLazyIterator, ofLazySpliterator, ofLazyStream, on, onceOnly, peek, prepend, prependOn, range, rangeClosed, rangeInt, rangeIntClosed, rangeLong, rangeLongClosed, repeat, repeatAll, repeatEach, reverse, skip, skipWhile, sorted, sorted, take, takeWhile, union, unionOn, zipAll, zipAny, zipBoth, zipLeft, zipRightforEach, spliteratorprotected PipeEnumerable(Iterable<T> source, Function<Enumerator<E>,Enumerator<T>> operator, Supplier<Boolean> onceOnly)
PipeEnumerable using a regular Iterable
as a link.source - Iterable source.operator - Enumerator transformation being added to the
pipe.onceOnly - true if operator is a once-only
operation, false otherwise.PipeEnumerableprotected PipeEnumerable(PipeEnumerable<?,T> source, Function<Enumerator<E>,Enumerator<T>> operator, Supplier<Boolean> onceOnly)
PipeEnumerable using a Enumerable as a link.source - Iterable source.operator - Enumerator transformation being added to the
pipe.onceOnly - true if operator is a once-only
operation, false otherwise.PipeEnumerableprotected boolean internalOnceOnly()
AbstractEnumerableEnumerator
only once.
This method is the internal counterpart of AbstractEnumerable.onceOnly().
internalOnceOnly in class AbstractEnumerable<E>AbstractEnumerable.enumerator() may be called
only once, false otherwise.protected Enumerator<E> internalEnumerator()
AbstractEnumerableEnumerator for the current Enumerable.
This method is the internal counterpart of AbstractEnumerable.enumerator().
internalEnumerator in class AbstractEnumerable<E>Enumerator instance.Enumerablepublic static <T,E> PipeEnumerable<T,E> of(Iterable<? extends T> source, Function<Enumerator<E>,Enumerator<T>> operator, Supplier<Boolean> onceOnly)
PipeEnumerable instance with the given source,
operator and once only flag.T - type of source enumerated elements.E - type of enumerated elements.source - source of elements to transform.operator - transformation to apply on elements.onceOnly - true of the operation can be applied only
once, false otherwise.PipeEnumerable instance.public static <E> Enumerable<E> concat(Enumerable<E> enumerable, Iterable<? extends E> elements)
elements to the given enumerable.E - type of enumerated elements.enumerable - Enumerable to concatenate to.elements - Iterable to concatenate.Enumerable.public static <E> Enumerable<E> distinct(Enumerable<E> enumerable)
Enumerable that has the same elements as the given
enumerable but with duplicates removed.E - type of enumerated elements.enumerable - Enumerable to get the elements from.Enumerable with duplicates removed.public static <E> Enumerable<E> filter(Enumerable<E> enumerable, Predicate<? super E> predicate)
Enumerable that has the elements of the given
enumerable that pass the given predicate.E - type of enumerated elements.enumerable - Enumerable to filter.predicate - condition filtering the elements.Enumerable.public static <E,R> Enumerable<R> flatMap(Enumerable<E> enumerable, Function<? super E,? extends Iterable<? extends R>> mapper)
Enumerable that replaces the elements of the given
enumerable with the elements of the Iterable obtained
by applying the given mapper on the each element.E - type of enumerated elements to map.R - type of mapped enumerated elements.enumerable - Enumerable to flat-map.mapper - transformer to apply on each source enumerated element.Enumerable.Iterablepublic static <E> Enumerable<E> limit(Enumerable<E> enumerable, long maxSize)
Enumerable that limits the elements of the given
enumerable to the given limit.E - type of enumerated elements.enumerable - source Enumerable.maxSize - enumeration limit.Enumerable.public static <E> Enumerable<E> limitWhile(Enumerable<E> enumerable, Predicate<? super E> predicate)
Enumerable that limits the elements of the given
enumerable while the given predicate holds true when
applied on the elements of the given enumerable.E - type of enumerated elements.enumerable - source Enumerable.predicate - limiting Predicate.Enumerable.public static <E,R> Enumerable<R> map(Enumerable<E> enumerable, Function<? super E,? extends R> mapper)
Enumerable that maps the elements of the given
enumerable to the values mapped by mapper applied on
each element and its index.
The index of the first enumerated element is 0.
E - type of source enumerated elements.R - type of mapped enumerated elements.enumerable - source Enumerable.mapper - element transformer.Enumerable.public static <E,R> Enumerable<R> map(Enumerable<E> enumerable, BiFunction<? super E,? super Long,? extends R> mapper)
Enumerable that maps the elements of the given
enumerable to the values mapped by mapper applied on
each element and its index.
The index of the first enumerated element is 0.
E - type of source enumerated elements.R - type of mapped enumerated elements.enumerable - source Enumerable.mapper - element transformer.Enumerable.public static <E> Enumerable<E> peek(Enumerable<E> enumerable, Consumer<? super E> action)
Enumerable that peeks the elements of the given
enumerable, applies the given action on each of them
and then returns the elements unchanged.E - type of enumerated elements.enumerable - source Enumerable.action - Consumer to apply on each element.Enumerable.public static <E> Enumerable<E> skip(Enumerable<E> enumerable, long n)
Enumerable that skips n times over the
elements of the given enumerable.E - type of enumerated elements.enumerable - source enumerable.n - number of elements to skip.Enumerable.public static <E> Enumerable<E> skipWhile(Enumerable<E> enumerable, Predicate<? super E> predicate)
Enumerable that skips the elements of the given
enumerable while the given predicate holds true.E - type of enumerated elements.enumerable - source Enumerable.predicate - skipping Predicate.Enumerable.public static <E> Enumerable<E> takeWhile(Enumerable<E> enumerable, Predicate<? super E> predicate)
Enumerable that limits the elements of the given
enumerable while the given predicate holds true when
applied on the elements of the given enumerable.E - type of enumerated elements.enumerable - source Enumerable.predicate - limiting Predicate.Enumerable.public static <E> Enumerable<Optional<E>[]> zipAll(Enumerable<E> enumerable, Iterable<? extends E> first, Iterable<? extends E>... rest)
Enumerable that zips the elements of the given
enumerable with the elements of the first
Iterable and the elements of the rest of the given
Iterable instances.E - type of enumerated elements to zip.enumerable - Enumerable to zip.first - first Iterable to zip with.rest - rest of the Iterable to zip with.Enumerable.Copyright © 2016. All rights reserved.