Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8242281

IntStream.html#reduce doc should not mention average

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b26
    • Verification:
      Not verified

      Description

      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.


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jboes Julia Boes
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: