-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
8u51
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-
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-
- duplicates
-
JDK-8043327 Collectors.toMap studentToGPA example uses Functions.identity()
-
- Closed
-