I need a TreeMap
that can hold multiple values so I chose MultiValueMap
from Commons Collections 4.0
With HashMap it's easy
private MultiValueMap<String, Pair<Integer, String>> foo =
new MultiValueMap<String, Pair<Integer, String>>();
but when I want to use some other map implementation like TreeMap
, The constructor becomes pretty awkward..
//they hide MultiValueMap(Map map, Factory factory),
//so I'll have to use static multiValueMap(...) instead
private MultiValueMap<String, Pair<Integer, String>> directoryMap=
MultiValueMap.multiValueMap(new TreeMap<String, Pair<Integer, String>>());
now, Eclipse throws me this:
The method multiValueMap(Map<K,? super Collection<V>>) in the type MultiValueMap is not
applicable for the arguments (TreeMap<String,Pair<Integer,String>>)
So, my question is, what does it mean by Map<K,? super Collection<V>>
?
I tried new TreeMap<String, ArrayList<Pair<Integer, String>>>()
but that didn't work either.