天天看點

Sream流處理List對象集合根據其中某個字段去重

userList = userList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(User::getUserid))), ArrayList::new));

繼續閱讀