This does need iteration unfortunately. But it’s pretty trivial with Java 8 streams:
mapCopy = map.entrySet().stream()
.collect(Collectors.toMap(e -> e.getKey(), e -> List.copyOf(e.getValue())))
This does need iteration unfortunately. But it’s pretty trivial with Java 8 streams:
mapCopy = map.entrySet().stream()
.collect(Collectors.toMap(e -> e.getKey(), e -> List.copyOf(e.getValue())))