List of utility methods to do List Join
String | stringJoin(List list, String separator) Join a list of objects to a string with a given separator by calling Object.toString() on the elements. StringBuilder ret = new StringBuilder(); boolean first = true; for (Object o : list) { if (!first) { ret.append(separator); ret.append(o); first = false; ... |
String | stringJoin(List string Join if (list == null) return null; StringBuilder sb = new StringBuilder(); for (String s : list) { if (sb.length() > 0) sb.append(sep); sb.append(s); return sb.toString(); |
String | trimAndJoin(List trim And Join if (values == null || values.isEmpty()) return null; StringBuilder delimited = new StringBuilder(); Iterator<Object> valuesI = values.iterator(); while (valuesI.hasNext()) { delimited.append(valuesI.next().toString().trim()); if (valuesI.hasNext()) delimited.append(delimiter); ... |