Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
包含:转新集合,过滤,分组,排序,求和,平均,最大值,最小值,分隔,合并,去重
例子
//转新list 比如取出商品ids
List ids=CollStreamUtil.toList(commoditys,Commondity::getId);
//过滤出价格>100
List commoditys=CollStreamUtil.filterList(commoditys,commodity->commdity.getPrice().compareTo(BigDecimal.valueOf(100))>0);
//按商品类型分组
Map<String,List>=CollStreamUtil.groupBy(commoditys,Commondity::getCategory);
//按商品名称去重
List commoditys=CollStreamUtil.distinct(commoditys,Commondity::getName);
//合并两个商品集合
List commoditys=CollStreamUtil.mergeAll(commoditys1,commoditys2);
//合并两个商品集合通过name去重保留左边集合数据
List commoditys=CollStreamUtil.leftMerge(commoditys,Commondity::getName);
其它操作详见工具类。