reduce abstract method

int reduce(
  1. int identity,
  2. int op(
    1. int,
    2. int
    )
)

Performs a reduction on the elements using the given identity and associative accumulation function.

Example

final sum = IntStream.range(1, 5)
    .reduce(0, (a, b) => a + b); // 10

Implementation

int reduce(int identity, int Function(int, int) op);