//反转map的key-value
Map<String, String> nameAndCodeMap = codeAndNameMap.entrySet().stream()
.collect(Collectors.toMap(
Map.Entry :: getValue,
Map.Entry :: getKey
));
//反转map的key-value
Map<String, String> nameAndCodeMap = codeAndNameMap.entrySet().stream()
.collect(Collectors.toMap(
Map.Entry :: getValue,
Map.Entry :: getKey
));
本文标题:反转map的key-value
本文链接:https://www.haomeiwen.com/subject/swjhmltx.html
网友评论