摘要: jdk 1.8 Stream 使用 主要有如下几种场景: 1、group by (分组) 2、order by (排序) 3、where (筛选) 4、distinct (去重) 5、appLy (根据某个属性进行各种操作) 6、提取某个属性为列表 2.1、group by 根据性别进行分组 use 阅读全文
posted @ 2022-04-27 15:54 北方有鱼 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 2.1 创建流 // 集合创建流 List list = new ArrayList<>(); // 获取一个顺序流 Stream listStream = list.stream(); // 获取一个并行流 Stream parallelListStream = list.parallelStre 阅读全文
posted @ 2022-04-27 14:26 北方有鱼 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 阅读原文 ForEach 集合的遍历forEach方法 public void testForEach(){ List<String> list = new ArrayList<String>() {{ add("1"); add("2"); add("3"); }}; list.forEach(s 阅读全文
posted @ 2022-04-27 10:11 北方有鱼 阅读(64) 评论(0) 推荐(0) 编辑