changeset 8897:5d2bbe0c3b32

Spec tweaks from EG review
author briangoetz
date Tue, 25 Jun 2013 16:27:19 -0400
parents 54f3d8ed2428
children 8975674bfabc
files src/share/classes/java/util/stream/Collector.java src/share/classes/java/util/stream/Collectors.java
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/stream/Collector.java	Tue Jun 25 19:14:55 2013 +0200
+++ b/src/share/classes/java/util/stream/Collector.java	Tue Jun 25 16:27:19 2013 -0400
@@ -60,7 +60,8 @@
  *
  *     // Find highest-paid employee
  *     Employee highestPaid = employees.stream()
- *                                     .collect(Collectors.maxBy(Comparators.comparing(Employee::getSalary)));
+ *                                     .collect(Collectors.maxBy(Comparators.comparing(Employee::getSalary)))
+ *                                     .get();
  *
  *     // Group employees by department
  *     Map<Department, List<Employee>> byDept
@@ -68,7 +69,7 @@
  *                    .collect(Collectors.groupingBy(Employee::getDepartment));
  *
  *     // Find highest-paid employee by department
- *     Map<Department, Employee> highestPaidByDept
+ *     Map<Department, Optional<Employee>> highestPaidByDept
  *         = employees.stream()
  *                    .collect(Collectors.groupingBy(Employee::getDepartment,
  *                                                   Collectors.maxBy(Comparators.comparing(Employee::getSalary))));
--- a/src/share/classes/java/util/stream/Collectors.java	Tue Jun 25 19:14:55 2013 +0200
+++ b/src/share/classes/java/util/stream/Collectors.java	Tue Jun 25 16:27:19 2013 -0400
@@ -80,7 +80,8 @@
  *
  *     // Find highest-paid employee
  *     Employee highestPaid = employees.stream()
- *                                     .collect(Collectors.maxBy(Comparator.comparing(Employee::getSalary)));
+ *                                     .collect(Collectors.maxBy(Comparator.comparing(Employee::getSalary)))
+ *                                     .get();
  *
  *     // Group employees by department
  *     Map<Department, List<Employee>> byDept
@@ -88,7 +89,7 @@
  *                    .collect(Collectors.groupingBy(Employee::getDepartment));
  *
  *     // Find highest-paid employee by department
- *     Map<Department, Employee> highestPaidByDept
+ *     Map<Department, Optional<Employee>> highestPaidByDept
  *         = employees.stream()
  *                    .collect(Collectors.groupingBy(Employee::getDepartment,
  *                                                   Collectors.maxBy(Comparator.comparing(Employee::getSalary))));