Lambda删除List中数据
List.removeIf(e -> e.getName().equals("张三"));
Lambda分组排序
reversed倒序
Map<String, List<User> collectMap = logList.stream()
.sorted(Comparator.comparing(User::getCreateTime).reversed())
.collect(Collectors.groupingBy(User::getUserName));
Lambda取每个key的第一条数据
List<AfinApprovalLog> tempList = new ArrayList<>();
collectMap.forEach((key ,value) -> {
tempList.add(value.get(0));
});
Lambda取交集
//取交集
List<User> innerList = tempList.stream()
.filter(m -> userList.stream().map(d -> d.getUserName()).collect(Collectors.toList())
.contains(m.getUserName())).collect(Collectors.toList());