List使用stream进行去重
根据某一字段进行去重
List<Entity> arrays = arr.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Entity :: getId))), ArrayList::new));
根据某一字段进行去重
List<Entity> arrays = arr.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Entity :: getId))), ArrayList::new));