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

Typo in API reference documentation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 8u51
    • core-libs

      A DESCRIPTION OF THE PROBLEM :
      the example code :
           Map<Student, Double> studentToGPA
               students.stream().collect(toMap(Functions.identity(),
                                               student -> computeGPA(student)));

      uses Functions.identity() while the interface name is Function.identity()

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
           Map<Student, Double> studentToGPA =
               students.stream().collect(Collectors.toMap(Function.identity(),
                                               student -> computeGPA(student)));
      ACTUAL -
           Map<Student, Double> studentToGPA
               students.stream().collect(toMap(Functions.identity(),
                                               student -> computeGPA(student)));

      URL OF FAULTY DOCUMENTATION :
      https://docs.oracle.com/javase/8/docs/api/java/util/stream/Collectors.html#toMap-java.util.function.Function-java.util.function.Function-

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: