List of utility methods to do Collection Join
String | join(Collection> items, char separator) Creates a backslash escaped string, joining all the items. if (items == null) return ""; StringBuilder sb = new StringBuilder(items.size() << 3); boolean first = true; for (Object o : items) { String item = String.valueOf(o); if (first) { first = false; ... |
String | join(Collection> items, String delim) join if (items.isEmpty()) { return ""; StringBuilder sb = new StringBuilder(); for (Object o : items) { sb.append(o.toString()); sb.append(delim); sb.delete(sb.length() - delim.length(), sb.length()); return sb.toString(); |
String | join(Collection> items, String delimiter) Joins items of the provided collection into a single String using the delimiter specified. if (items == null) { return null; StringBuilder joinedValues = new StringBuilder(); Iterator<?> iterator = items.iterator(); if (iterator.hasNext()) { joinedValues.append(iterator.next().toString()); while (iterator.hasNext()) { joinedValues.append(delimiter); joinedValues.append(iterator.next().toString()); return joinedValues.toString(); |
String | join(Collection> iterable, String delimiter) join return join(iterable, delimiter, null, null);
|
String | join(Collection> objects, String token, StringBuilder buf) join for (Iterator<?> it = objects.iterator(); it.hasNext();) { buf.append(it.next()).append(token); buf.delete(buf.lastIndexOf(token), buf.length()); return buf.toString(); |
String | join(Collection> objectsToJoin, String separator) Joins all the strings in the list in a single one separated by the separator sequence. if ((objectsToJoin != null) && !objectsToJoin.isEmpty()) { StringBuilder builder = new StringBuilder(); for (Object object : objectsToJoin) { builder.append(object); builder.append(separator); return builder.substring(0, builder.length() - separator.length()); } else { ... |
String | join(Collection> objs, String delim) join if (objs == null) { return ""; StringBuilder ret = new StringBuilder(); boolean needDelim = false; for (Object obj : objs) { if (needDelim) { ret.append(delim); ... |
String | join(Collection> objs, String delim) join if (objs == null) { return ""; StringBuilder str = new StringBuilder(); boolean needDelim = false; for (Object obj : objs) { if (needDelim) { str.append(delim); ... |
String | join(Collection> objs, String delimiter) Converts an array of objects to a delimited string representation. assert delimiter != null : "Delimiter should not be null"; if (objs == null || objs.size() == 0) { return ""; StringBuffer buffer = new StringBuffer(); for (Object obj : objs) { if (buffer.length() > 0) { buffer.append(delimiter); ... |
String | join(Collection> objs, String sep) Join a collection with a separator string StringBuilder sb = new StringBuilder(); boolean first = true; for (Object obj : objs) { if (!first) { sb.append(sep); sb.append(obj.toString()); first = false; ... |