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  艺言弈行  阅读(25)  评论(0)    收藏  举报