您当前的位置: 首页 > 

java持续实践

暂无认证

  • 3浏览

    0关注

    746博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

jdk8的stream 自定义根据某个实体属性名称去重

java持续实践 发布时间:2022-01-26 10:36:29 ,浏览量:3

https://www.cnblogs.com/lucky-jun/p/15029505.html

import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toCollection;

List personList =personList.stream().collect(collectingAndThen(
                            toCollection(() -> new TreeSet(Comparator.comparing(Person::getName))), ArrayList::new));
关注
打赏
1658054974
查看更多评论
立即登录/注册

微信扫码登录

0.0392s