Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;

import org.apache.http.NameValuePair;

import org.apache.http.message.BasicNameValuePair;

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

        return nvps;
    }
}