Map kv拼接,by 传统方式
作者:互联网
/**
* Map kv拼接
* key1=value1&key2=value2
*
* @param map
* @return
*/
public static String getString(Map<String, String> map) {
String param = "";
Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, String> entry = iterator.next();
if (!param.equals("")) {
param = param.concat("&");
}
param = param.concat(entry.getKey())
.concat("=")
.concat(entry.getValue());
}
return param;
}
标签:Map,iterator,map,param,拼接,kv,entry,concat 来源: https://blog.csdn.net/Sunxn1991/article/details/122240704