Here you can find the source of stringToMap(String input)
public static Map<String, String> stringToMap(String input)
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, String> stringToMap(String input) { Map<String, String> map = new HashMap<String, String>(); String[] nameValuePairs = input.split("&"); for (String nameValuePair : nameValuePairs) { String[] nameValue = nameValuePair.split("="); try { map.put(URLDecoder.decode(nameValue[0], "UTF-8"), nameValue.length > 1 ? URLDecoder.decode(nameValue[1], "UTF-8") : ""); } catch (UnsupportedEncodingException e) { throw new RuntimeException("This method requires UTF-8 encoding support", e); }//from ww w. j a v a 2 s . c om } return map; } }