Other technologies I know (.Net, JS) contain the simplest fold/reduce operation:
TResult reduce(TResult result, (TResult prevResult, TValue value) -> TResult)
One method I found requires TValue and TResult to be the same type. Other one requires providing BinaryOperation that combines 2 TResults. None of those constraints matches my context. For now I ended up with code like:
Accumulator acc = someInitialValue;
for(Element element: list) {
accumulator = reducer(accumulator, element);
}
but I believe so the basic method should be contained in stream API.
I have also taken a look for collectors, but I haven't found anything helpful.