Created
July 16, 2018 08:04
-
-
Save smallsong/61c65ecf7449ab39c7c14260ca55ff76 to your computer and use it in GitHub Desktop.
map to queryString
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String mapToQueryString(Map<String, String> map) { | |
StringBuilder string = new StringBuilder(); | |
String queryString = map.entrySet() | |
.stream() | |
.map(Object::toString) | |
.collect(joining("&")); | |
if(map.size() > 0) { | |
string.append("?"); | |
} | |
string.append(queryString); | |
return string.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment