hashmap排序
2017-10-17 16:39
232 查看
HashMap<Integer,ClassGroupModel> hashS1=new HashMap<Integer, ClassGroupModel>();
//遍历有效公司的排序 ArrayList<Map.Entry<Integer,ClassGroupModel>> listG= new ArrayList<Map.Entry<Integer,ClassGroupModel>>(hashS1.entrySet()); Collections.sort(listG, new Comparator<Map.Entry<Integer, ClassGroupModel>>() { public int compare(Map.Entry<Integer, ClassGroupModel> o1, Map.Entry<Integer, ClassGroupModel> o2) { return (new Double(o2.getValue().getOwnerEquity()).intValue()- new Double(o1.getValue().getOwnerEquity()).intValue()); } });
ps:o2-o1 倒序 o1-o2 正序 进行排序的值必须要是int类型
相关文章推荐
- hashmap排序
- hashmap排序
- 分别根据key和value对HashMap进行排序
- 【转载】HashMap的两种排序方式
- HashMap:对key进行排序
- List<LinkedHashMap<String,String>>排序
- hashMap 排序方法
- hashMap,treeMap,LinkedHashMap的默认排序
- Java 对HashMap<String,Double>排序
- Collections.sort()对HashMap里的键值对按照键进行排序
- Java中HashMap排序和遍历
- Java如何对HashMap按值进行排序
- hashmap排序
- HashMap排序
- Treemap 有序的hashmap。用于排序
- 面试笔记----------HashMap排序
- HashMap的两种排序方式
- Java中HashMap中对value对象进行排序
- HashMap加入数据后,会自动根据首字母排序
- HashMap的倒序排序