码迷,mamicode.com
首页 > 编程语言 > 详细

关于java8(Stream)的一些用法

时间:2019-04-12 10:23:47      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:方法   tin   用法   cto   box   str   去重   list   nbsp   

如果要处理int[] 转换成 List<Integer>这种形式的,可以用下面这个方法:

List<Integer> orgIds = Arrays.stream(reqVo.organizationIds).boxed().collect(Collectors.toList());

 

过滤去重可以用下面这个方法:

List<Integer> newOrgIds =orgIds .stream().distinct().collect(Collectors.toList());

关于java8(Stream)的一些用法

标签:方法   tin   用法   cto   box   str   去重   list   nbsp   

原文地址:https://www.cnblogs.com/PrayzzZ/p/10694362.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!