- 概念
stream: a sequence of elements from a source that supports data processing operations.
一个例子
...
List<String> lowCaloriesDishName = menus.stream()
.filter(d -> d.getCalories() < 400)
.sorted(Comparator.comparing(Dish::getCalories))
.map(Dish::getName)
.collect(Collectors.toList());
lowCaloriesDishName.forEach(item -> {
System.out.println(item);
});
...