Open wilsonpenha opened 7 years ago
This is because the source code was updated to Java 9.
takeWhile is a new method added to Stream interface in Java 9:
filtering and flatMapping where added to the Collectors interface:
This book's name is Java8InAcation. However the source has already updated to Java9.
private static Map<Dish.Type, Set> groupDishTagsByType() {
return menu.stream().collect(groupingBy(Dish::getType, flatMapping(dish -> dishTags.get( dish.getName() ).stream(), toSet())));
}
-> flatMapping shown as invalid and don't compile the class
// return menu.stream().filter(dish -> dish.getCalories() > 500).collect(groupingBy(Dish::getType)); return menu.stream().collect(groupingBy(Dish::getType, filtering(dish -> dish.getCalories() > 500, toList()))); } -> filtering shown as invalid and don't compile the class