java8 枚举List匹配添加另一个list的值

直接附上代码:

 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());
        });

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章