stream流思想应用

1、计算集合中某字段数值和

subTotal = subTotal+ complainCountResult.stream().filter(childSource->childSource.getSourceId().equals(childSourceId)).mapToInt(DataDictionaryModel::getCount).sum();

 

2、产生新集合

List<XfDictStatisticModel> streamStatisticModelListNew = dictStatisticModelListNew.stream().
                        filter(streamStatisticModel->streamStatisticModel.getCantonCode().equals(xfDictStatisticModel.getParentCantonCode())).collect(Collectors.toList());

 

3、

 

posted @ 2019-10-15 15:49  wmqiang  阅读(245)  评论(0编辑  收藏  举报