List集合根据某个字段去重 foreverlove 2022-06-10 287 阅读1分钟 list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() ->new TreeSet<>(Comparator.comparing(User::getId))), ArrayList::new));