Folds the stream into a single value by applying the accumulator function to each element, starting from the initial value.
Example:
int sum = stream.reduce<int> (0, (acc, x) => { return acc + x; });
| initial |
the initial accumulator value. |
| fn |
the accumulator function. |
|
the accumulated result. |