I have TreeMap
which I need to convert to URI-like string and then back to Map.
I need to set custom delimiters.
Is there any tool (Gu
In java 8 and up there is another way without external dependencies: use StringJoiner:
List cities = Arrays.asList("Milan",
"London",
"New York",
"San Francisco");
String citiesCommaSeparated = String.join(",", cities);
System.out.println(citiesCommaSeparated);
//Output: Milan,London,New York,San Francisco
Credits and example go to this URL (https://reversecoding.net/java-8-convert-list-string-comma/)