map排序

submitButtonOrder.properties
#签字意见按钮顺序(以0,1,2,3....依次排序)
submit=0
reject=1
opinions=2
handforward=3
forward=4
save=5
Retractback=6

代码块中
// 按钮顺序调整
String submit_B = Util.null2String(Prop.getPropValue("submitButtonOrder","submit"));
String reject_B = Util.null2String(Prop.getPropValue("submitButtonOrder","reject"));
String opinions_B = Util.null2String(Prop.getPropValue("submitButtonOrder","opinions"));
String handforward_B = Util.null2String(Prop.getPropValue("submitButtonOrder","handforward"));
String forward_B = Util.null2String(Prop.getPropValue("submitButtonOrder","forward"));
String save_B = Util.null2String(Prop.getPropValue("submitButtonOrder","save"));
String Retractback_B = Util.null2String(Prop.getPropValue("submitButtonOrder","Retractback"));

new weaver.general.BaseBean().writeLog("submit_B==="+submit_B);
 Map order_map = new HashMap();
 order_map.put("submit_B",submit_B);
 order_map.put("reject_B",reject_B);
 order_map.put("opinions_B",opinions_B);
 order_map.put("handforward_B",handforward_B);
 order_map.put("forward_B",forward_B);
 order_map.put("save_B",save_B);
 order_map.put("Retractback_B",Retractback_B);

 List> list_order = new ArrayList>(order_map.entrySet());  
        Collections.sort(list_order,new Comparator>() {  
            //升序排序  
            public int compare(Map.Entry o1, Map.Entry o2) {  
                return o1.getValue().compareTo(o2.getValue());  
            }    
        });

for(Map.Entry mapping:list_order){ 
                                new weaver.general.BaseBean().writeLog(mapping.getKey()+":"+mapping.getValue()); 
}

image.png

其他参考
http://blog.csdn.net/zhushuai1221/article/details/51760574

你可能感兴趣的:(map排序)