I didn\'t find such a multimap construction... When I want to do this, I iterate over the map, and populate the multimap. Is there an other way?
final Map<
Assuming you have
Map> map = ...;
Multimap multimap = ArrayListMultimap.create();
Then I believe this is the best you can do
for (String key : map.keySet()) {
multimap.putAll(key, map.get(key));
}
or the more optimal, but harder to read
for (Entry> entry : map.entrySet()) {
multimap.putAll(entry.getKey(), entry.getValue());
}