Skip to content

Instantly share code, notes, and snippets.

@LenarBad
Created April 8, 2019 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LenarBad/de3681746163a0a0f0f3a548345a6433 to your computer and use it in GitHub Desktop.
Save LenarBad/de3681746163a0a0f0f3a548345a6433 to your computer and use it in GitHub Desktop.
Parameter map to url query
private String mapToQuery(Map<String, String> parameters) {
String query = "";
if (parameters != null && !parameters.isEmpty()){
query = "?" +
parameters.entrySet().stream()
.map(entry -> entry.getKey() + "=" + entry.getValue())
.collect(Collectors.joining("&"));
}
return query;
}
@LenarBad
Copy link
Author

LenarBad commented Apr 8, 2019

More on lenar.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment