stream:
集合分组:
Map<String, List<Student>> collect = list.stream().collect(Collectors.groupingBy(Student::getSex));
集合取出某一属性方法:
List<String> tableNames=list.stream().map(User::getMessage).collect(Collectors.toList());
集合过滤filter:
//过滤出符合条件的数据 List<Apple> filterList = appleList.stream().filter(a -> a.getName().equals("香蕉")).collect(Collectors.toList());
求和:
BigDecimal totalMoney = appleList.stream().map(Apple::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);