Here you can find the source of buildNameValuePair( Hashtable
private static List<NameValuePair> buildNameValuePair( Hashtable<String, String> httpPost)
//package com.java2s; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; public class Main { private static List<NameValuePair> buildNameValuePair( Hashtable<String, String> httpPost) { if (httpPost == null) return null; List<NameValuePair> nvps = new ArrayList<NameValuePair>(); Enumeration<String> keys = httpPost.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); String value = (String) httpPost.get(key); BasicNameValuePair nv = new BasicNameValuePair(key, value); nvps.add(nv);// ww w .j a va 2 s .co m } return nvps; } }