List根据多个字段分组

List<ClassEntity> distinctClass = classEntities.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getProfessionId() + ";" + o.getGrade()))), ArrayList::new));

posted on 2018-06-05 15:59  还有梦  阅读(7724)  评论(0编辑  收藏  举报

导航