![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Stream流
capricornce
这个作者很懒,什么都没留下…
展开
-
java8 Stream流 两个list取交集,获取共有数据
代码:public static void main(String[] args) { List<String> list1 = Arrays.asList("a","b","c"); List<String> list2 = Arrays.asList("b","c","d"); List<String> intersection = list1.stream().filter(item -> list2.co原创 2021-08-04 14:52:52 · 2097 阅读 · 0 评论 -
Stream流处理List对象集合根据其中某个字段去重
userList = userList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(User::getUserid))), ArrayList::new));原创 2021-07-07 10:04:04 · 1702 阅读 · 0 评论 -
Stream流,java分组统计,List转Map<String,List>格式
这两天使用Idea过程中遇到整理格式的快捷键不能用了。想必肯定是热键被占用了,查看一下:找到罪魁祸首了,去追拿元凶:禁用全局快捷键,搞定:附上软件神器的官网链接:查看热键神器官方链接...原创 2021-07-05 17:08:29 · 3154 阅读 · 7 评论 -
java8 Stream流排序
//按年龄排序(Integer类型),默认升序List<StudentInfo> studentsSortName = studentList.stream().sorted(Comparator.comparing(StudentInfo::getAge).reversed()).collect(Collectors.toList());加reversed(),反转即降序//按年龄排序(Integer类型)List<StudentInfo> studentsSor.原创 2021-06-30 16:26:47 · 328 阅读 · 0 评论