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 Details

    • andThen

      default <X> StreamFunction<I,X> andThen(StreamFunction<O,X> next)
      Generic chaining: StreamFunctioninvalid input: '<'I, O> fn = StreamFunction.identity() .andThen(a -> fn(a))...andThen(o -> fn(o));...
      Type Parameters:
      X -
      Parameters:
      next -
      Returns:
    • andThenMap

      default <X> StreamFunction<I,X> andThenMap(SerializableFunction<O,X> mapper)
      invalid input: '{@code andThenMap(x -> y) is a short hand for {@code andThen(flowable -> flowable.map(x -> y))} @param <X> @param mapper @return'
    • andThenFlatMap

      default <X> StreamFunction<I,X> andThenFlatMap(SerializableFunction<O, ? extends Stream<X>> mapper)
    • andThenFlatMapIterable

      default <X> StreamFunction<I,X> andThenFlatMapIterable(SerializableFunction<O, ? extends Iterable<X>> mapper)
    • from

      static <I,O> StreamFunction<I,O> from(StreamFunction<I,O> rxfn)
    • identity

      static <X> StreamFunction<X,X> identity()
    • identity

      static <X> StreamFunction<X,X> identity(Class<X> cls)
      Identity function that is more natural to use than the no-arg version:
      StreamFunction.identity(MyClass.class).andThen(rest)