Lambda操作

1、对集合根据某字段进行去重

List<OrgVideoTreeDto> orgDemoList = orgDemoList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(OrgVideoTreeDto :: getId))),ArrayList :: new));
//非对象集合去重
List<String> list = list.stream().,distinct().collect(Collectors.toList());
posted @ 2021-11-04 14:42  老婆爱榴莲  阅读(36)  评论(0)    收藏  举报