关于java8(Stream)的一些用法

若是要处理int[] 转换成 List<Integer>这种形式的,能够用下面这个方法:io

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

 

过滤去重能够用下面这个方法:List

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

相关文章
相关标签/搜索