如何对数组进行排序?
前
{"A"=1, "B"=1, "C"=3},
{"A"=1, "B"=1, "C"=2},
{"A"=1, "B"=11, "C"=2},
{"A"=1, "B"=2, "C"=2},
{"A"=1, "B"=1, "C"=11}
后
{"A"=1, "B"=1, "C"=2},
{"A"=1, "B"=1, "C"=3},
{"A"=1, "B"=1, "C"=11},
{"A"=1, "B"=2, "C"=2},
{"A"=1, "B"=11, "C"=2}
代码
ArrayList mylist = new ArrayList();
Map<String,Integer> mMap = new HashMap<String,Integer>();
mMap.put("A",1);
mMap.put("B",1);
mMap.put("C",3);
mylist.add(mMap);
mMap = new HashMap<String,Integer>();
mMap.put("A",1);
mMap.put("B",1);
mMap.put("C",2);
mylist.add(mMap);
mMap = new HashMap<String,Integer>();
mMap.put("A",1);
mMap.put("B",11);
mMap.put("C",2);
mylist.add(mMap);
mMap = new HashMap<String,Integer>();
mMap.put("A",1);
mMap.put("B",2);
mMap.put("C",2);
mylist.add(mMap);
mMap = new HashMap<String,Integer>();
mMap.put("A",1);
mMap.put("B",1);
mMap.put("C",11);
mylist.add(mMap);