lamada表达式优化多层for循环速度
作者:互联网
相对于直接双层for循环,速度起飞
Map<String,Map<String,String>> map2= resultList.stream().collect(
Collectors.toMap(s->getKeyStr(s),s->s));
dataList.forEach(c->{
if(map2.get(getKey(c))!=null){
c.put("debitStartSum",map2.get(getKey(c)).get("debitStartSum"));
});
public String getKeyStr(Map<String,String>s){
return String.valueOf(s.get("sys_object_id"))+","+String.valueOf(s.get("account"))+","
+String.valueOf(s.get("currency_type"))+","+String.valueOf(s.get("sb_id"));
}
标签:String,get,valueOf,多层,map2,lamada,debitStartSum,id,表达式 来源: https://blog.csdn.net/ashe1318758303/article/details/104758653