Skip to content

Instantly share code, notes, and snippets.

@CaptainBern
Created June 24, 2014 09:51
Show Gist options
  • Save CaptainBern/00e688511957ed442fdb to your computer and use it in GitHub Desktop.
Save CaptainBern/00e688511957ed442fdb to your computer and use it in GitHub Desktop.
public String format(List<String> list){
boolean isFirst = false;
StringBuilder sb = new StringBuilder();
for(String entry : list) {
if (isFirst) {
isFirst = false;
} else {
sb.append(",");
}
sb.append(entry);
}
return sb.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment