List of utility methods to do Collection Join
String | join(final String sep, final Collection extends Object> c) Join a bunch of objects into a string delimited by the separator if (c == null) { return null; if (c.size() == 1) { return String.valueOf(c.iterator().next()); if (c.size() == 0) { return ""; ... |
String | join(final String sep, final Collection Join the given strings, separated by the given separator. final StringBuilder sb = new StringBuilder(); String s = ""; for (final String str : strs) { sb.append(s).append(str); s = sep; return sb.toString(); |
String | join(final String separator, final Collection Returns a string of the form elt1.toString() [sep elt2.toString() ... if (objects.isEmpty()) { return ""; } else { final Iterator<T> iter = objects.iterator(); final T first = iter.next(); if (!iter.hasNext()) return first.toString(); else { ... |
String | join(final String separator, final Collection Returns a string of the form elt1.toString() [sep elt2.toString() ... if (objects.isEmpty()) { return ""; } else { final Iterator<T> iter = objects.iterator(); final T first = iter.next(); if (!iter.hasNext()) return first.toString(); else { ... |
String | join(final String separator, final Collection Returns a string of the form elt1.toString() [sep elt2.toString() ... if (objects.isEmpty()) { return ""; } else { final Iterator<T> iter = objects.iterator(); final T first = iter.next(); if (!iter.hasNext()) return first.toString(); else { ... |
String | join(Iterable collection, String delimiter) Concatenates the elements from the collection to one string. return join(collection.iterator(), delimiter);
|
String | join(Iterable> collection) join return join(collection, DEFAULT_DELIMITER);
|
String | join(String c, Collection d) Similar to join / implode in php. StringBuilder res = new StringBuilder(); boolean notFirst = false; for (Iterator i = d.iterator(); i.hasNext();) { if (notFirst) res.append(c); else notFirst = true; res.append(i.next()); ... |
String | join(String delim, Collection list) join return join(delim, list.toArray());
|
String | join(String delim, Collection> col) join StringBuilder sb = new StringBuilder(); Iterator<?> iter = col.iterator(); if (iter.hasNext()) sb.append(iter.next().toString()); while (iter.hasNext()) { sb.append(delim); sb.append(iter.next().toString()); return sb.toString(); |