What is the purpose of wildcard in accumulator argument of Stream.reduce?

Viewed 164

A reduce method of a Java Stream:

<U> U reduce(U identity,
             BiFunction<U, ? super T, U> accumulator,
             BinaryOperator<U> combiner);

helps reduce the stream based on some property of objects in the stream.

However, it is not clear to me why the accumulator could not be more straightforward and serving the same purpose:

BiFunction<U, T, U> accumulator.

What additional flexibility does the wildcard in accumulator's signature provide (at the cost of reduced readability)?

2 Answers
Related