Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@LenarBad 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