Compact way to create Guava Multimaps?
Why aren't you using ArrayListMultimap.create()
for such a simple case? It's the default way to create the simple HashMap/ArrayList that is probably the most common used multimap.
I run into this problem when writing clients and building up maps of query params. A nice succinct pattern I like for constructing multi-maps is to use ImmutableMultiMap#builder
Multimap<String, String> queryParams =
ImmutableMultimap.<String, String>builder()
.put("key-1", "value-1")
.put("key-1", "value-2")
.build();