All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.awsjavakit.misc.paths.QueryStringSplitter Maven / Gradle / Ivy

There is a newer version: 0.19.4
Show newest version
package com.github.awsjavakit.misc.paths;

import java.net.URI;
import java.util.Arrays;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;

class QueryStringSplitter {

  public static final String CATCH_AMPERSAND_WHEN_NOT_ESCAPED = "(? toMap() {
    var queryString = uri.getQuery();
    return
      Arrays.stream(queryString.split(CATCH_AMPERSAND_WHEN_NOT_ESCAPED))
        .map(str -> str.split(ASSIGNMENT_OPERATOR))
        .map(array -> Map.entry(array[PROPERTY_PART], array[VALUE_PART]))
        .collect(Collectors.toMap(Entry::getKey, Entry::getValue));

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy