프로그래밍언어/Java
Stream으로 map을 다른 타입 map으로 변환
codinglog
2021. 11. 11. 16:45
Map<String, String> x;
Map<String, Integer> y =
x.entrySet().stream()
.collect(Collectors.toMap(
e -> Map.Entry::getKey,
e -> Integer.parseInt(e.getValue())
));
반응형