List.stream().collect()方法

Map> levelList = bottles.stream()

                .collect(groupingBy(ProductBottle::getLevel, mapping(ProductBottle::getQrcode, toList())));


java8 新特性学习 转自 http://ifeve.com/stream/ 

其次是map,我们知道map的key是不能重复的,所以groupingBy就针对于相同key值做了处理:转自https://blog.csdn.net/Hatsune_Miku_/article/details/73414406 

结果为以level分组的map集合

使用java8的lambda将list转为map:转自  https://www.cnblogs.com/xujanus/p/6133865.html



你可能感兴趣的:(java8)