场景:
java的 stream 流是非常重要的特性,在开发中是必备的技能,这里着重分析一下 Collectors.groupingBy() 的各种用法
验证数据准备:
List<TestDailyOne> exampleList = ListUtil.toList(new TestDailyOne(1L, "张三1", 25),new TestDailyOne(2L, "张三2", 35),new TestDailyOne(3L, "张三3", 25),new TestDailyOne(4L, "张三4", 30),new TestDailyOne(5L, "张三5", 30),new TestDailyOne(6L, "张三6", 25),new TestDailyOne(7L, "张三7", 35),new TestDailyOne(8L, "张三8", 35),new TestDailyOne(9L, "张三9", 35),new TestDailyOne(11L, "张三11", 35),new TestDailyOne(10L, "张三10", 35),new TestDailyOne(11L, "张三12", 35));