关于list某个字段求和
requestDTO.getAfterSalesSkuList().stream(). mapToInt(AfterSalesSkuRequestDTO::getAfterSalesNumber).sum()
关于list某个字段分组返回 List
list.stream().map(MerchantNoWithdrawalVO::getMemberNo).collect(Collectors.toList())
基于checkList 进行 skuId去重得到size
Integer nowSize = checkList.stream().collect(Collectors.collectingAndThen( Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(sku -> sku.getSkuId()))), ArrayList::new)).size();
基于list 进行某个字段组合 以逗号分隔
String msg = productList.stream().map(MerchantB2bMarketCheckProductVO::getProductName).collect(Collectors.joining(","));
基于list 进行某个字段去重 返回
memberList.stream().map(MerchantB2bMarketCheckVO::getMarketNo).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
foreach设置多个属性值
namespaceList.stream().forEach( ff -> { ff.setWorkspace(f.getWorkspace()); ff.setDescription(f.getDescription()); } );