Skip to content

Instantly share code, notes, and snippets.

@antonshkurenko
Created June 13, 2016 11:39
Show Gist options
  • Save antonshkurenko/8613d105665bd2a3f9c2132fd5ca6cf9 to your computer and use it in GitHub Desktop.
Save antonshkurenko/8613d105665bd2a3f9c2132fd5ca6cf9 to your computer and use it in GitHub Desktop.
public static <T> String toDelimitedString(List<T> list, String delimiter) {
final StringBuilder strb = new StringBuilder();
for (T t : list) {
strb.append(String.valueOf(t)).append(delimiter);
}
return strb.substring(0, strb.length() - delimiter.length());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment