Java Lambda 使用示例

1、遍历集合并得到新对象

List<RpcCustomerImageDTO> customerImgList= customerImageList.stream().filter(a -> a.getImgKey() !=null ).

collect(Collectors.toList());

2、遍历集合并得到新对象

List<RpcCustomerImageDTO> businessLicenseImgList = customerImageList.stream().filter(a -> a.getImgKey().equals(UserSyncWjConstant.BUSINESS_LICENSE_PICTURE)).collect(Collectors.toList());      
 

3、返回集合中对象的属性

List<String> orgCodeList = orgList.stream().map(Org::getOrgCode).collect(Collectors.toList());
posted @ 2022-03-11 09:27  二叉树的博客  阅读(103)  评论(0编辑  收藏  举报