java中把map转换成list

来源:互联网 发布:九乐软件下载 编辑:程序博客网 时间:2024/05/16 13:40
        private String key;private String value;//把map转换成list的公共方法public static List mapToList(Map map){List list=new ArrayList();Iterator it=map.keySet().iterator();while(it.hasNext()){String key=it.next().toString();ExponseConstants exponseConstants=new ExponseConstants();exponseConstants.setKey(key);exponseConstants.setValue(map.get(key).toString());list.add(exponseConstants);}return list;}public String getKey() {return key;}public void setKey(String key) {this.key = key;}public String getValue() {return value;}public void setValue(String val) {this.value = val;}

原创粉丝点击