//T作为泛型,具体对象代入即可,xxxx代表要根据属性去除的数据
List<T> newList = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(()->new TreeSet<>(Comparator.comparing(T::xxxx))),ArrayList::new));
Steam去除集合重复数据
最新推荐文章于 2024-01-11 16:35:16 发布