List of utility methods to do Collection Join
String | join(Collection strings, String sep) Join a collection of strings by a seperator return join(strings.iterator(), sep);
|
String | join(Collection strings, String separator) join return join((String[]) strings.toArray(new String[0]), separator); |
String | join(Collection tokens, String separator) join StringBuffer sb = new StringBuffer(); for (Iterator it = tokens.iterator(); it.hasNext();) { Object o = it.next(); if (o != null) { sb.append(o.toString()); } else { sb.append("NULL"); if (it.hasNext()) { sb.append(separator); return sb.toString(); |
String | join(Collection var0, Object var1) Borrowed from apache StringUtils. StringBuffer var2 = new StringBuffer(); for (Iterator var3 = var0.iterator(); var3.hasNext(); var2.append(var3.next())) { if (var2.length() != 0) { var2.append(var1); return var2.toString(); |
String | join(Collection extends Object> c, String joinWith) Returns a string consisting of all members of a collection separated by the specified string. if (c == null) return ""; StringBuilder buf = new StringBuilder(); boolean first = true; for (Object obj : c) { if (first) first = false; else if (joinWith != null) ... |
String | join(Collection extends Object> collection, String joinString) join StringBuilder sb = new StringBuilder(); Iterator<? extends Object> iter = collection.iterator(); while (iter.hasNext()) { sb.append(iter.next()); if (iter.hasNext()) { sb.append(joinString); return sb.toString(); |
String | join(Collection extends Object> collection, String separator) Joins a collection of Objects separated by a specified separator if (collection == null) { return null; Iterator iterator = collection.iterator(); if (iterator == null) { return null; if (!iterator.hasNext()) { ... |
String | join(Collection extends Object> elements, String separator) join Iterator<? extends Object> iterator = elements.iterator(); if (iterator.hasNext()) { StringBuilder builder = new StringBuilder(); builder.append(iterator.next().toString()); while (iterator.hasNext()) { builder.append(separator); builder.append(iterator.next().toString()); return builder.toString(); } else { return ""; |
String | join(Collection extends Object> list, String separator) join StringBuilder sb = new StringBuilder(); for (Object o : list) { sb.append(o.toString()); sb.append(separator); if (sb.length() > 0 && separator.length() > 0) { sb.delete(sb.length() - separator.length(), sb.length()); return sb.toString(); |
String | join(Collection extends Object> objects, String delim) Join a set of strings into one string, putting the specified delimiter between adjacent strings. String result = ""; if (objects.size() > 0) { String[] array; int i; Iterator it; i = 0; for (it = objects.iterator(); it.hasNext();) { Object o = it.next(); ... |