java中把map转换成list

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;
	}

你可能感兴趣的:(java中把map转换成list)