-----数据
[{liubei=刘备},{guanyu=关羽},{zhangfei=张飞}]
-----目标
{liubei=刘备,guanyu=关羽,zhangfei=张飞}
第一种
List<Map<String,Object>> lists=new ArrayList<>();
Map<String, Object> merged = new HashMap<>();
lists.forEach(merged::putAll);
第二种
// 不想覆盖,保留最初的值:
List<Map<String,Object>> lists=new ArrayList<>();
lists.stream().flatMap(m -> m.entrySet().stream())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a));
// 覆盖key相同的值:
List<Map<String,Object>> lists=new ArrayList<>();
lists.stream().flatMap(m -> m.entrySet().stream())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> b));