List of utility methods to do Collection Join
StringBuilder | joinToStringBuilder(Collection> collection, String separator) Concatenates the Collection of Objects (converted to Strings using .toString()) into a StringBuilder using the separator as the delimiter. if (collection == null) { return new StringBuilder(); StringBuilder result = new StringBuilder(collection.size() * 10); boolean needjoin = false; for (Object obj : collection) { if (needjoin) { result.append(separator); ... |
String | joinValues(Collection join Values StringBuilder builder = new StringBuilder(); boolean first = true; for (String value : values) { if (!first) { builder.append(separator); } else { first = false; builder.append(value); return builder.toString(); |
String | roundjoin(Collection s, String delimiter) roundjoin StringBuffer buffer = new StringBuffer(); Iterator iter = s.iterator(); while (iter.hasNext()) { buffer.append(String.valueOf(Math.round(328.084 * ((Double) iter.next())) / 100.00)); if (iter.hasNext()) { buffer.append(delimiter); return buffer.toString(); |
String | stringJoin(Collection list, String delim) string Join StringBuilder sb = new StringBuilder(); for (Object s : list) { if (s == null) { continue; if (sb.length() > 0) { sb.append(delim); sb.append(s.toString()); return sb.toString(); |
String | stringJoin(java.util.Collection> s, String delimiter) string Join StringBuilder builder = new StringBuilder(); java.util.Iterator<?> iter = s.iterator(); while (iter.hasNext()) { builder.append(iter.next()); if (!iter.hasNext()) { break; builder.append(delimiter); ... |