Java Utililty Methods URL Query Parse

List of utility methods to do URL Query Parse

Description

The list of methods to do URL Query Parse are organized into topic(s).

Method

Map>parseQueryString(String queryString)
parse Query String
return PATTERN_AND.splitAsStream(queryString).map(s -> Arrays.copyOf(s.split("="), 2))
        .collect(Collectors.groupingBy(s -> s[0], Collectors.mapping(s -> s[1], toList())));
MapparseQueryString(String queryString)
parse Query String
Map<String, String[]> map = new HashMap<String, String[]>();
if (queryString != null && !queryString.isEmpty()) {
    StringTokenizer parser = new StringTokenizer(queryString, "&?;=", true);
    String name = null;
    String value = null;
    while (parser.hasMoreTokens()) {
        String token = parser.nextToken();
        String ttoken = token.trim();
...
MapparseQuerystring(String queryString)
Parse a querystring into a map of key/value pairs.
Map<String, String> map = new HashMap<String, String>();
if ((queryString == null) || (queryString.equals(""))) {
    return map;
String[] params = queryString.split("&");
for (String param : params) {
    try {
        String[] keyValuePair = param.split("=", 2);
...
voidparseQueryString(String queryString, Map params)
This method parses a query string
if (queryString == null || params == null) {
    return;
if (queryString.length() > 0) {
    String token;
    int offset;
    StringTokenizer tokenizer = new StringTokenizer(queryString, "&");
    while (tokenizer.hasMoreTokens()) {
...
MultimapparseQueryStringEx(String queryString)
parse Query String Ex
Multimap<String, String> result = ArrayListMultimap.create();
if (queryString == null) {
    return result;
for (String param : queryString.split("&")) {
    String pair[] = param.split("=");
    String key = URLDecoder.decode(pair[0], "UTF-8");
    String value = "";
...
MapparseURLQuery(String query)
Parse an URL/URI query string consisting of attribute=value pairs separated by ampersands, into a map of the attribute name mapped to their values.
if (query == null)
    return null;
Map<String, String> result = new HashMap<String, String>();
if (query != null) {
    query = URLDecoder.decode(query, "8859_1");
    String[] st = query.split("&");
    for (int i = 0; i < st.length; i++) {
        String[] av = st[i].split("=", 2);
...