Package org.aksw.commons.util.stream
Interface StreamFunction<I,O>
- Type Parameters:
I-O-
- All Superinterfaces:
Function<Stream<I>,,Stream<O>> Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface StreamFunction<I,O>
extends Function<Stream<I>,Stream<O>>, Serializable
Helper interface to make transformations on streams less verbose
Inherits from
Function for out of the box chaining with Function.andThen(Function).- Author:
- Claus Stadler 11/09/2020
-
Method Summary
Modifier and TypeMethodDescriptiondefault <X> StreamFunction<I,X> andThen(StreamFunction<O, X> next) Generic chaining: StreamFunction<I, O> fn = StreamFunction.identity() .andThen(a -> fn(a))...andThen(o -> fn(o));...default <X> StreamFunction<I,X> andThenFlatMap(SerializableFunction<O, ? extends Stream<X>> mapper) default <X> StreamFunction<I,X> andThenFlatMapIterable(SerializableFunction<O, ? extends Iterable<X>> mapper) default <X> StreamFunction<I,X> andThenMap(SerializableFunction<O, X> mapper) {@code andThenMap(x -> y) is a short hand for {@code andThen(flowable -> flowable.map(x -> y))} @param <X> @param mapper @returnstatic <I,O> StreamFunction<I, O> from(StreamFunction<I, O> rxfn) static <X> StreamFunction<X,X> identity()static <X> StreamFunction<X,X> Identity function that is more natural to use than the no-arg version:
-
Method Details
-
andThen
Generic chaining: StreamFunction<I, O> fn = StreamFunction.identity() .andThen(a -> fn(a))...andThen(o -> fn(o));...- Type Parameters:
X-- Parameters:
next-- Returns:
-
andThenMap
{@code andThenMap(x -> y) is a short hand for {@code andThen(flowable -> flowable.map(x -> y))} @param <X> @param mapper @return -
andThenFlatMap
-
andThenFlatMapIterable
default <X> StreamFunction<I,X> andThenFlatMapIterable(SerializableFunction<O, ? extends Iterable<X>> mapper) -
from
-
identity
-
identity
Identity function that is more natural to use than the no-arg version:StreamFunction.identity(MyClass.class).andThen(rest)
-