xxx.stream()
.collect(Collectors.toMap(
xxx::getId,
dto -> new xxx(dto.getName(), dto.getComment()),
(existing, replacement) -> existing
));
要记得加上冲突行为,防止意外报错
(existing, replacement) -> existing
1万+

被折叠的 条评论
为什么被折叠?



