I have a List<Map.Entry<Long, String>>
.
How do I convert this into a Map
?
Currently I am doing the following, but it seems a bit verbose (and most importantly, it is not "fluent", i.e. a single expression, but requires a code block).
Map<Long, String> result = new HashMap<>();
entries.forEach(e -> result.put(e.getKey(), e.getValue()));
return result;
Java 10 is fine.