对List<Map<String, Object>>集合排序

 

private void mySort(List<Map<String, Object>> list) {
        //list为待排序的集合,按SEQ字段排序
        Comparator<Map<String, String>> mapComprator = new Comparator<Map<String, String>>() {  
            @Override  
            public int compare(Map<String, String> o1,  
                    Map<String, String> o2) {  
                if (Integer.valueOf(o1.get("SEQ").toString()) > Integer.valueOf(o2.get("SEQ").toString())) {  
                    return 1;  //此处是按降序排序
                } else {  
                    return -1;  
                }  
            }  
        };  
        Collections.sort((List)list, mapComprator);  
    }

 

posted @ 2014-11-05 16:35  用户没有名  阅读(196)  评论(0编辑  收藏  举报