Last active
December 30, 2015 02:09
-
-
Save sscovil/7760745 to your computer and use it in GitHub Desktop.
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 mapToString(List<String> list, String separator, String encapsulator) { | |
StringBuilder stringBuilder = new StringBuilder(); | |
for (String item : list) { | |
if (stringBuilder.length() > 0) stringBuilder.append(separator); | |
stringBuilder.append(String.format("%1$s%2$s%1$s", encapsulator, item)); | |
} | |
return stringBuilder.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment