展开全部
用我这个32313133353236313431303231363533e4b893e5b19e31333335306264排序不是更简单么import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class $ {
public static void main(String[] args) {
List> list = new ArrayList>();
Map map = new HashMap();
Map map1 = new HashMap();
Map map2 = new HashMap();
Map map3 = new HashMap();
map.put("number", 1);
map1.put("number", 2);
map2.put("number", 4);
map3.put("number", 3);
list.add(map);
list.add(map1);
list.add(map2);
list.add(map3);
Collections.sort(list, new Comparator>() {
public int compare(Map o1, Map o2) {
int map1value = (Integer) o1.get("number");
int map2value = (Integer) o2.get("number");
return map1value - map2value;
}
});
System.out.println(list);
}
}