1.java8 list集合按着某个字段分组后转map
Map<Integer, List<SopEntity>> sopIdListMap =
sopEntities.stream().collect(Collectors.groupingBy(SopEntity::getId));
2.Java8 list集合去重(根据ID)
List<User> list = userList.stream()
.collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(User::getUserId))), ArrayList::new));
3.Java8 list集合去除null值
List<user> result = list.stream().filter(item ->
item.getUserId!=null).collect(Collectors.toList());
4.Java8 普通集合对象转map
Map<Long, VipEntity> vipMap = vipList
.stream().collect(Collectors
.toMap(VipEntity::getUserId, v -> v, (v1, v2) -> v1));
5.Java8 集合数据(可根据时间或年龄等)排序 升序或降序
dtoList.sort((m1, m2) -> m2.getPunchT