java8Stream的新特性

java8的特性的进阶之路
eg1:
codesList.forEach(codes->{
List list = allocationExtRepository.findByCodeInAndBusiUnitGid(codes,busiUnitGid);
if (!CollectionUtils.isEmpty(list)){
allList.addAll(list);
}
});
eg2:
allList.stream().forEach(f -> {
String key = f.getCode();
if (!resultMap.containsKey(key)) {
resultMap.put(key, f);
}
});
便利list,看出区别了吗?

你可能感兴趣的:(java8Stream的新特性)