取2个List对象,根据里面2个List相同的字段进行比较取值 List<AssetTextContentDTO> collect = textContentDTOS.stream().map(m -> { assets.stream().filter(m2 -> Objects.equals(m.getAssetId(), m2.getAssetId())).forEach(m2 -> { m.setAssetName(m2.getAssetName()); }); return m; }).collect(Collectors.toList());
Java 8 stream 取List2个对象相同值返回
最新推荐文章于 2024-07-29 14:22:26 发布