//对两个 List 遍历匹配数据的优化处理 支持一对多 public List> compareListHitData(List> ChannelList, List> UpdatList) { //两个List 如果ID==CHANNEL_ID 用UUID替换掉CHANNEL_ID List> resultList = UpdatList.stream().map(map -> ChannelList.stream() .filter(m -> Objects.equals(m.get("ID"), map.get("CHANNEL_ID"))) .findFirst().map(m ->{ map.put("CHANNEL_ID",m.get("UUID")); //map.putAll(m); return map; }).orElse(null)) .filter(Objects::nonNull).collect(Collectors.toList()); }