合并list数据相加操作

Map, GoodsDTO> goodsDtoMap = dropGoodsDTOList.stream().collect(Collectors.toMap(GoodsDTO::getId, Function.identity(), (key1, key2) -> {
    key2.setNum(key1.getNum() + key2.getNum());
    return key2;
}));

你可能感兴趣的:(Java基础)