List集合中对对象中的某个属性进行分组、过滤或去重操作
1、根据courseList对象中的userId属性进行分组查询
Map<String, List<Course>> collect = courseList.stream().collect(Collectors.groupingBy(Course::getUserId));
2、根据courseList对象中的userId属性进行分组查询并对score属性进行汇总
Map<String, Double> collect = courseList.stream().collect(Collectors.groupingBy(Course::getUserId,Collectors.summingDouble(Course::getScore)));
3、判断一组对象里面有没有属性值是某个值
List<User> userList = userDao.getUserList();
boolean isExit= userList .stream().anyMatch(m -> "plan:ctPlan:add".equals(m.getPermission()));
4、取出一组对象的某个属性组成一个新集合
List<String> userNames=userList.stream()