我想创建一个Integer到的映射String,并且这个映射对我的键进行排序。所以我使用:
TreeMap<Integer, String> thm = new TreeMap<Integer, String>();
thm.put(100, "String 1");
thm.put(11, "String 2");
thm.put(100, "String 3");
问题是当我有两个相同的键时,我TreeMap只包含一个!如何创建一个TreeMap包含两个相同 kays 的 cobntains ?如果TreeMap不能解决我的问题,我该怎么办?
我读了你的回复, Guava Tree multi-map 但 multiMap 没有订购我的钥匙