1、更新多个键: List<Map<String, Object>> returnList = new ArrayList<>(); returnList.put("aa","1"); returnList.put("bb","2"); returnList.stream().map(x -> { //aa修改为a,bb修改为b x.put("a",x.remove("aa")); x.put("b",x.remove("bb")); return x; }).collect(Collectors.toList());
2、更新一个键:
returnList.forEach(s -> s.put("createTime",s.remove("createtime")));