-
Bug
-
Resolution: Fixed
-
P4
-
8
-
b26
-
Not verified
A DESCRIPTION OF THE PROBLEM :
This API https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/util/stream/IntStream.html#reduce(int,java.util.function.IntBinaryOperator) requires that the IntBinaryOperator is an associative accumulation function, as the documentation mentions.
Down below, the documentation mentions "Sum, min, max, and average [...]", then goes on to exemplify how to compute a sum.
Mentioning "average" also may imply to some readers that it can be computed using reduce(), however this is not the case as average is not an associative operation.
This API https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/util/stream/IntStream.html#reduce(int,java.util.function.IntBinaryOperator) requires that the IntBinaryOperator is an associative accumulation function, as the documentation mentions.
Down below, the documentation mentions "Sum, min, max, and average [...]", then goes on to exemplify how to compute a sum.
Mentioning "average" also may imply to some readers that it can be computed using reduce(), however this is not the case as average is not an associative operation.
- csr for
-
JDK-8245970 IntStream.html#reduce doc should not mention average
-
- Closed
-