MYYA
有序Map可以用TreeMap来实现,所以我在示例中用的java.util.TreeMap。一般SortedMap都可以用一个Comparator作为构建参数,那么你可以自己写一个Comparator来实现排序,下面就是例子importjava.util.*;publicclassTest{privateSortedMapfirst;privateSortedMapsecond;privateSortedMapthird;privateSortedMapmain;publicTest(){first=newTreeMap();second=newTreeMap();third=newTreeMap();main=newTreeMap(newComparator(){publicintcompare(Stringk1,Stringk2){Integerv1=first.get(k1)+second.get(k1)+third.get(k1);Integerv2=first.get(k2)+second.get(k2)+third.get(k2);returnv2-v1;}});}publicvoidput(Stringkey,Stringvalue,Integerv1,Integerv2,Integerv3){first.put(key,v1);second.put(key,v2);third.put(key,v3);main.put(key,value);}publicSortedMapgetMain(){returnmain;}publicstaticvoidmain(String[]args){Testtest=newTest();test.put("a","aaaaaaaa",1,2,3);test.put("b","bbbbbbbb",10,20,30);test.put("c","cccccccc",5,15,20);test.put("d","dddddddd",100,1,3);for(Map.Entryentry:test.getMain().entrySet()){System.out.println(entry.getKey()+":"+entry.getValue());}}}