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

 

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