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

Documentation for Stream.reduce should mention that commutative is also required

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 8u25
    • core-libs

      A DESCRIPTION OF THE PROBLEM :
      Stream.reduce should also note that the binary operation needs to be commutative as well as associative. Consider a stream of 2 by 2 matrices using matrix multiplication. This is associative (and their is an identity) but if run from a parallel stream the answer could vary.


      URL OF FAULTY DOCUMENTATION :
      https://docs.oracle.com/javase/8/docs/api/

            smarks Stuart Marks
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: