Here you can find the source of queryToMap(final String query)
public static Map<String, String> queryToMap(final String query)
//package com.java2s; //License from project: Open Source License import com.google.common.base.Strings; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, String> queryToMap(final String query) { final Map<String, String> map = new HashMap<String, String>(); final String[] keyValuePairs = query.split("&"); for (String KeyValuePair : keyValuePairs) { final String[] KeyValue = KeyValuePair.split("="); try { map.put(URLDecoder.decode(KeyValue[0], "UTF-8"), Strings.nullToEmpty(KeyValue[1])); } catch (UnsupportedEncodingException e) { throw new RuntimeException("This method requires UTF-8 encoding support", e); }// w w w. j a v a 2 s . c om } return map; } }