List of utility methods to do List Join
String | toCommaSeperatedList(List to Comma Seperated List StringBuilder result = new StringBuilder(); for (String string : values) { result.append(",").append(string); return result.toString().replaceFirst(",", ""); |
String | implode(List list, String glue) implode String str = ""; int i = 0; for (Iterator it = list.iterator(); it.hasNext();) { Object object = (Object) it.next(); if (i < list.size() - 1) { str += object.toString() + glue; } else { str += object.toString(); ... |
String | joinList(String seperator, List extends Object> list) join List return joinList(seperator, list, ""); |
String | joinList(String seperator, List extends Object> list, String def) join List if (list.isEmpty()) return def; StringBuilder b = new StringBuilder(); boolean first = true; for (Object s : list) { if (!first) b.append(seperator); b.append(s.toString()); ... |