reduce abstract method

T reduce(
  1. T identity,
  2. T accumulator(
    1. T,
    2. T
    )
)

Performs a reduction on the elements of this stream, using the provided identity value and an associative accumulation function, and returns the reduced value.

Example

final sum = GenericStream.of([1, 2, 3, 4, 5])
    .reduce(0, (a, b) => a + b);

Implementation

T reduce(T identity, T Function(T, T) accumulator);