map排序

作者: 秋天de童话 | 来源:发表于2018-08-25 16:36 被阅读10次
    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<String, String> order_map = new HashMap<String, String>();
     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<Map.Entry<String,String>> list_order = new ArrayList<Map.Entry<String,String>>(order_map.entrySet());  
            Collections.sort(list_order,new Comparator<Map.Entry<String,String>>() {  
                //升序排序  
                public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {  
                    return o1.getValue().compareTo(o2.getValue());  
                }    
            });
    
    for(Map.Entry<String,String> mapping:list_order){ 
                                    new weaver.general.BaseBean().writeLog(mapping.getKey()+":"+mapping.getValue()); 
    }
    
    
    image.png

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

    相关文章

      网友评论

          本文标题:map排序

          本文链接:https://www.haomeiwen.com/subject/evkprxtx.html