Skip to main content

type pipe

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

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

Definition

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