直接附上代碼:
List<Map<String, Object>> list = ProtocolTypeEnum.getAllRentTemplate();//枚舉List
List<Map<String, Object>> protocolList = this.findProtocolByContId(contractId);
list.forEach(map -> {
protocolList.stream().map(item -> {
//根據枚舉類型比對相應的值
if (Objects.equals(item.get("fileType"), map.get("code"))) {
map.putAll(item);
}
return map;
}).distinct().collect(Collectors.toList());
});