T - type of the Streamable's Stream elements.@FunctionalInterface public interface Streamable<T>
Stream. While for
Iterator there is a Iterable no such thing exists for
Stream in the JDK. This provides such a type. Currently it lifts
filter(...), map(...) and flatMap(...) of
Stream into itself.
REMARK: in future iterations more functions of Stream may be lifted
into this type.| Modifier and Type | Method and Description |
|---|---|
default Streamable<T> |
concat(Streamable<T>... streamables)
Concatenenats streameables.
|
static <T1> Streamable<T1> |
concat(Streamable<T1> head,
Streamable<T1>... tail)
Concatenate Streamables.
|
default Streamable<T> |
distinct()
Filters a
Streamable in to a Streamable of distinct values. |
default Streamable<T> |
filter(Predicate<? super T> predicate) |
default <R> Streamable<R> |
flatMap(Function<? super T,? extends Streamable<? extends R>> mapper)
Lazily maps over the elements given the provided flat mapping function.
|
default Streamable<T> |
limit(long maxSize)
Limits the
Streamable to maxSize elements. |
default <R> Streamable<R> |
map(Function<? super T,? extends R> mapper)
Lazily maps over the elements given the provided mapping function.
|
default Streamable<T> |
parallel()
Parallelizes the
Stream provided by this
Streamable. |
default Streamable<T> |
peek(Consumer<? super T> action)
Inserts an action into the stream execution.
|
default Streamable<T> |
sequential()
Unparallelizes the
Stream provided by this
Streamable. |
default Streamable<T> |
skip(Long n)
Skip {code n} elemenents in the {link java.util.stream.Stream}
|
default Streamable<T> |
sorted()
Sorts the
Stream provided by this
Streamable. |
default Streamable<T> |
sorted(Comparator<? super T> comparator)
Sorts the
Stream provided by this
Streamable. |
Stream<T> |
stream()
Gets a "fresh"
Stream of T. |
default Streamable<T> |
unordered()
Allows the
Stream provided by this
Streamable to be unordered |
default Streamable<T> filter(Predicate<? super T> predicate)
default <R> Streamable<R> map(Function<? super T,? extends R> mapper)
R - return type of the elements to be provided by the
Stream of the returned Streamablemapper - mapping functionStreamable that returns a Stream of Rdefault <R> Streamable<R> flatMap(Function<? super T,? extends Streamable<? extends R>> mapper)
R - return type of the elements to be provided by the
Stream of the returned Streamablemapper - mapping function.Streamable that returns a Stream of Rdefault Streamable<T> concat(Streamable<T>... streamables)
streamables - streamables to be concatenatedstatic <T1> Streamable<T1> concat(Streamable<T1> head, Streamable<T1>... tail)
T1 - type of Streamables in tailhead - first streamabletail - other streameables to be concatenated to the head.default Streamable<T> distinct()
Streamable in to a Streamable of distinct values.Streamable of distinct values.default Streamable<T> limit(long maxSize)
Streamable to maxSize elements.maxSize - the maximum number of elements to returnStreamable of maxSize elementsdefault Streamable<T> parallel()
Stream provided by this
Streamable.Streamable that provides a parallel
Streamdefault Streamable<T> peek(Consumer<? super T> action)
action - the action to insertStreamable with the action inserted into the processing of
the Stream.default Streamable<T> sequential()
Stream provided by this
Streamable.Streamable that provides a sequential
Streamdefault Streamable<T> skip(Long n)
n - number of elements to skipn elements in the
Stream skippeddefault Streamable<T> sorted()
Stream provided by this
Streamable.Streamable that provides a sorted
Streamdefault Streamable<T> sorted(Comparator<? super T> comparator)
Stream provided by this
Streamable.comparator - the java.util.Comparator to use to sort the
Stream.Streamable that provides a sorted
Streamdefault Streamable<T> unordered()
Stream provided by this
Streamable to be unorderedStreamable that provides an unordered
StreamCopyright © 2021. All rights reserved.