java8 map过滤 map转字符串
Map<String,Long> map = new HashMap<>();
map.put("aaa",1L);
map.put("bbb",2L);
map.put("ccc",1L);
Map<String, Long> map2 = map.entrySet().stream().filter(e -> e.getValue().intValue() > 1)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
String str = map.entrySet().stream().filter(e -> e.getValue().intValue() > 1)
.map(e -> e.getKey())
.collect(Collectors.joining("、","{","}"));
浙公网安备 33010602011771号