java8对象去重

List<User> newList = objList.stream().collect(
	Collectors.collectingAndThen(
		Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(User::getUserId))),
		ArrayList::new
	)
);
posted @ 2023-02-28 10:51  艺言弈行  阅读(18)  评论(0编辑  收藏  举报