List of utility methods to do Collection Join
String | join(String separator, Collection c) join if (c.isEmpty()) return ""; StringBuilder sb = new StringBuilder(); Iterator i = c.iterator(); sb.append(i.next()); while (i.hasNext()) { sb.append(separator); sb.append(i.next()); ... |
String | join(String separator, Collection> items) join StringBuilder sb = new StringBuilder(); for (Object item : items) if (item != null) sb.append(separator).append(item); return sb.substring(separator.length()); |
String | join(String separator, Collection> items) join StringBuilder result = new StringBuilder((separator.length() + 1) * items.size()); int i = 0; for (Object item : items) { if (i > 0) result.append(separator); result.append(item.toString()); i++; return result.toString(); |
String | join(String separator, Collection> objs) Stringify all the elements in the given collection, and join them with inserting the given separator. StringBuilder builder = new StringBuilder(); String sep = ""; if (objs != null) { for (Object o : objs) { builder.append(sep).append(String.valueOf(o)); sep = separator; return builder.toString(); |
String | join(String separator, Collection Converts a Collection to a separator separated string return join(separator, list, null);
|
String | join(String separator, Collection join StringBuilder builder = new StringBuilder(parts.size() * 16); boolean first = true; for (String line : parts) { if (!first) { builder.append(separator); if (line != null) { builder.append(line); ... |
String | join(String separator, Collection join if (separator == null) { throw new IllegalArgumentException("separator cannot be null"); if (strings != null && strings.size() > 0) { StringBuilder sb = new StringBuilder(); for (String s : strings) { sb.append(separator); sb.append(s); ... |
String | join(String separator, Collection join if (objects.isEmpty()) { return ""; Iterator<T> iter = objects.iterator(); final StringBuilder ret = new StringBuilder(iter.next().toString()); while (iter.hasNext()) { ret.append(separator); ret.append(iter.next().toString()); ... |
String | join(String separator, Collection join return join(new StringBuilder(), separator, values).toString(); |
String | join(String token, Collection strings) join StringBuffer sb = new StringBuffer(); for (Iterator iter = strings.iterator(); iter.hasNext();) { sb.append(iter.next()); if (iter.hasNext()) { sb.append(token); return (sb.toString()); ... |