List of utility methods to do Collection Join
String | join(Collection join return join(",", collections); |
String | join(String conjunction, Collection join int length = collections.length; if (length == 0) return null; Collection<Object> collection = (Collection<Object>) collections[0]; if (length > 1) { for (int i = 1; i < length; i++) { collection.addAll(collections[i]); StringBuilder sb = new StringBuilder(); boolean first = true; for (Object obj : collection) { if (obj == null) break; if (first) first = false; else sb.append(conjunction); sb.append(obj.toString()); return sb.toString(); |
String | suffixAndJoin(String suffix, String delimiter, Collection suffix And Join String result = join(suffix + delimiter, values);
return isEmpty(result) ? result : result + suffix;
|
String | toString(Collection extends Object> collection, String separator) Returns a String representation of the given collection by separating the elements with the given separator. if (collection == null || collection.isEmpty()) { return ""; StringBuilder builder = new StringBuilder(); int count = collection.size(); for (Object obj : collection) { builder.append(obj); if (--count > 0) { ... |
String | join(Collection collection, String s) join String s1; if (collection.size() == 0) { s1 = ""; } else { StringBuilder stringbuilder = new StringBuilder(); for (Iterator iterator = collection.iterator(); iterator .hasNext();) { String s2 = (String) iterator.next(); ... |
String | join(Collection Join a collection of strings by a seperator return join(strings.iterator(), sep);
|
String | join(Collection strings, String sep) Join a collection of strings by a seperator return join(strings.iterator(), sep);
|
String | join(final Collection> strings, String delimeter) Convenience function for joining strings using a delimeter if (delimeter == null) { delimeter = ","; if (strings.isEmpty()) { return ""; StringBuffer joined = new StringBuffer(); Iterator<?> stringIter = strings.iterator(); ... |
String | join(Collection> collection, String delimiter) Joins all items in the `collection` into a `string`, separated by the given `delimiter`. if (collection == null) return ""; StringBuilder buffer = new StringBuilder(); Iterator<?> iter = collection.iterator(); while (iter.hasNext()) { buffer.append(iter.next()); if (iter.hasNext()) { buffer.append(delimiter); ... |
String | join(Collection perform join operation on specified String collection sperated by specified delimiter if (s == null || s.isEmpty()) { return ""; StringBuilder builder = new StringBuilder(); Iterator<String> iter = s.iterator(); while (iter.hasNext()) { builder.append(iter.next()); if (!iter.hasNext()) { ... |