@FunctionalInterface public interface Streamable<T> extends Iterable<T>, Supplier<Stream<T>>
Iterable
s.Modifier and Type | Method and Description |
---|---|
default Streamable<T> |
and(Iterable<? extends T> iterable)
Creates a new
Streamable from the current one and the given Iterable concatenated. |
default Streamable<T> |
and(Streamable<? extends T> streamable)
Convenience method to allow adding a
Streamable directly as otherwise the invocation is ambiguous between
and(Iterable) and and(Supplier) . |
default Streamable<T> |
and(Supplier<? extends Stream<? extends T>> stream)
Creates a new
Streamable from the current one and the given Stream concatenated. |
default Streamable<T> |
and(T... others)
Creates a new
Streamable from the current one and the given values 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()
|
default List<T> |
toList()
Creates a new, unmodifiable
List . |
default Set<T> |
toSet()
Creates a new, unmodifiable
Set . |
static <S> Collector<S,?,Streamable<S>> |
toStreamable()
A collector to easily produce a
Streamable from a Stream using Collectors.toList() as
intermediate collector. |
static <S,T extends Iterable<S>> |
toStreamable(Collector<S,?,T> intermediate)
A collector to easily produce a
Streamable from a Stream and the given intermediate collector. |
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.default Streamable<T> and(T... others)
Streamable
from the current one and the given values concatenated.others
- must not be null.default Streamable<T> and(Iterable<? extends T> iterable)
Streamable
from the current one and the given Iterable
concatenated.iterable
- must not be null.default Streamable<T> and(Streamable<? extends T> streamable)
Streamable
directly as otherwise the invocation is ambiguous between
and(Iterable)
and and(Supplier)
.streamable
- must not be null.default List<T> toList()
List
.default Set<T> toSet()
Set
.static <S> Collector<S,?,Streamable<S>> toStreamable()
Streamable
from a Stream
using Collectors.toList()
as
intermediate collector.toStreamable(Collector)
static <S,T extends Iterable<S>> Collector<S,?,Streamable<S>> toStreamable(Collector<S,?,T> intermediate)
Streamable
from a Stream
and the given intermediate collector.Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.