重複の可能性:
TreeMap 値による並べ替え
こんにちは、キーではなく値で TreeMap コレクションを並べ替えたいと思います。たとえば、
TreeMap map=new TreeMap();
map.put(new Integer(100),"ccc");
map.put(new Integer(300),"bbb");
map.put(new Integer(200),"ddd");
map.put(new Integer(400),"aaa");
次のように注文する必要があります。
1) 400 -> aaa
2) 300 -> bbb
3) 100 -> ccc
4) 200 -> ddd