我的github
posts - 3243,  comments - 42,  views - 158万

Filter的用法:

复制代码
public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("杨贺铮");
        list.add("杨铮铮");
        list.add("王梦杰");
        list.add("武龙");

        //两次筛选
        list.stream()
                    //筛选去代杨字的
                    .filter(name ->name.startsWith("杨"))
                    //长度为3
                    .filter(name -> name.length()==3)
                    .forEach(System.out::println);
    }
复制代码

参考:https://blog.51cto.com/u_16099188/6336939

 List<Apple> apples = applestore
                        .stream()
                        .filter(a -> a.getColor().equals("red"))
                        .collect(Collectors.toList());

参考2:https://blog.csdn.net/weixin_45970271/article/details/122528391

参考3:https://blog.csdn.net/BHSZZY/article/details/122860048

>>arraylist函数说明(2.1部分):https://blog.csdn.net/zhangbeizhen18/article/details/126632981

posted on   XiaoNiuFeiTian  阅读(13)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2022-08-22 arcpy-计算统计值
2022-08-22 ARCGIS中如何按距离、平均、按比例来打断线(分段线)
2020-08-22 基于深度学习的遥感影像语义分割
2020-08-22 2020全国人工智能大赛遥感组
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示