I believe you're supposed to use
MultiValueMap.multiValueMap(
new TreeMap<String, Collection<Pair<Integer, String>>>());
...not referring to ArrayList
, since presumably the library wants the freedom to choose which collection implementation it puts in the map.
(That said: if you were to use Guava's Multimap
instead, you could get this in the much simpler line MultimapBuilder.treeKeys().arrayListValues().build()
and get the generics automatically inferred.)