@FunctionalInterface public interface Streamable<T> extends Iterable<T>, Supplier<Stream<T>>
Iterable
s.Modifier and Type | Method and Description |
---|---|
default Streamable<T> |
and(Supplier<? extends Stream<? extends T>> stream)
Creates a new
Streamable from the current one and the given Stream concatenated. |
static <T> Streamable<T> |
empty()
Returns an empty
Streamable . |
default Streamable<T> |
filter(Predicate<? super T> predicate)
Returns a new
Streamable that will apply the given filter Predicate to the current one. |
default <R> Streamable<R> |
flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
Returns a new
Streamable that will apply the given Function to the current one. |
default Stream<T> |
get() |
default boolean |
isEmpty()
Returns whether the current
Streamable is empty. |
default <R> Streamable<R> |
map(Function<? super T,? extends R> mapper)
Returns a new
Streamable that will apply the given Function to the current one. |
static <T> Streamable<T> |
of(Iterable<T> iterable)
Returns a
Streamable for the given Iterable . |
static <T> Streamable<T> |
of(Supplier<? extends Stream<T>> supplier) |
static <T> Streamable<T> |
of(T... t)
Returns a
Streamable with the given elements. |
default Stream<T> |
stream()
|
forEach, iterator, spliterator
static <T> Streamable<T> empty()
Streamable
.@SafeVarargs static <T> Streamable<T> of(T... t)
Streamable
with the given elements.t
- the elements to return.static <T> Streamable<T> of(Iterable<T> iterable)
Streamable
for the given Iterable
.iterable
- must not be null.static <T> Streamable<T> of(Supplier<? extends Stream<T>> supplier)
default <R> Streamable<R> map(Function<? super T,? extends R> mapper)
Streamable
that will apply the given Function
to the current one.mapper
- must not be null.Stream.map(Function)
default <R> Streamable<R> flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
Streamable
that will apply the given Function
to the current one.mapper
- must not be null.Stream.flatMap(Function)
default Streamable<T> filter(Predicate<? super T> predicate)
Streamable
that will apply the given filter Predicate
to the current one.predicate
- must not be null.Stream.filter(Predicate)
default boolean isEmpty()
Streamable
is empty.default Streamable<T> and(Supplier<? extends Stream<? extends T>> stream)
Streamable
from the current one and the given Stream
concatenated.stream
- must not be null.Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.