List<NameValuePair> nvps = new ArrayList<>();
Iterator<Entry<String, String>> iterator = parameters.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, String> entry = iterator.next();
NameValuePair nvp = new BasicNameValuePair(entry.getKey(), entry.getValue());
nvps.add(nvp);
}
byte[] receiveData = HttpPostClient.sendData(serverInterface, nvps);
return new String(receiveData);
}
2、public static String getKey(TreeMap<String,String> content){
StringBuffer keyType = new StringBuffer();
Iterator<String> it = content.keySet().iterator();
while (it.hasNext()) {
String key = it.next().toString();
String value = content.get(key);
if(StringUtils.isNotBlank(value)){
keyType.append(key);//it.next()得到的是key
keyType.append(SystemConstAndEnum.SPLIT_ARGS);
keyType.append(content.get(key));//得到value
}
if(it.hasNext()){
keyType.append(SystemConstAndEnum.SPLIT_FIELDS);
}
}
return keyType.toString();
}