Skip to main content

type pipe

Returns an AsyncReducer instance that first applies this reducer, and then applies the given next reducer to each output produced by the previous reducer.

example
AsyncStream
.from(Stream.of(1, 2, 3))
.reduce(
AsyncReducer.pipe(Reducer.product, Reducer.sum)
)
// => 9

Definition

pipe: {
    <I, O1, O2>(reducer1: AsyncReducer.Accept<I, O1>, reducer2: AsyncReducer.Accept<O1, O2>): AsyncReducer<I, O2>;
    <I, O1, O2, O3>(reducer1: AsyncReducer.Accept<I, O1>, reducer2: AsyncReducer.Accept<O1, O2>, reducer3: AsyncReducer.Accept<O2, O3>): AsyncReducer<I, O3>;
    <I, O1, O2, O3, O4>(reducer1: AsyncReducer.Accept<I, O1>, reducer2: AsyncReducer.Accept<O1, O2>, reducer3: AsyncReducer.Accept<O2, O3>, reducer4: AsyncReducer.Accept<O2, O4>): AsyncReducer<I, O4>;
    <I, O1, O2, O3, O4, O5>(reducer1: AsyncReducer.Accept<I, O1>, reducer2: AsyncReducer.Accept<O1, O2>, reducer3: AsyncReducer.Accept<O2, O3>, reducer4: AsyncReducer.Accept<O2, O4>, reducer5: AsyncReducer.Accept<O2, O5>): AsyncReducer<I, O5>;
  }