🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
### 主要API * Collectors.maxBy * Collectors.minBy * 计数 ``` long howManyDishes = menu.stream().collect(Collectors.counting()); long howManyDishes = menu.stream().count(); ``` * Collectors.summingInt * Collectors.summingLong * Collectors.summingDouble * 连接字符串 ``` String shortMenu = menu.stream().map(Dish::getName).collect(joining()); ``` * 分组 ``` Map<Dish.Type, List<Dish>> dishesByType = menu.stream().collect(groupingBy(Dish::getType)); Map<Dish.Type, Long> typesCount = menu.stream().collect( groupingBy(Dish::getType, counting())); //分组汇总 ``` * partitioningBy:分区