1.集合中获取指定的一个属性值
List<String> items = li.stream().map(ScdCostChargeItemEntity::getItem).collect(Collectors.toList());
2.集合分组
Map<String, List<T>> yearData = allData.stream().collect(Collectors.groupingBy(T::getYear));
2.集合过滤筛选(单条件):
List<T> filterList = appleList.stream().filter(a -> a.getName().equals("YC")).collect(Collectors.toList());
3.集合过滤筛选(多条件):
List<T> filterList = dayVoList. stream().filter(a -> a.getYEAR().equals(item)).collect(Collectors.toList()) .stream().filter(a -> a.getPrice() != "0" && a.getPrice() != "0.0").collect(Collectors.toList());
标签:toList,Collectors,stream,List,特性,filter,collect,java8 From: https://www.cnblogs.com/RedOrange/p/17091613.html