List of utility methods to do List Join
String | join(List list, String delimiter) Joins elements in List with a delimiter String String out = ""; for (int i = 0; i < list.size(); i++) { out += list.get(i); if (i < list.size() - 1) { out += delimiter; return out; ... |
String | join(List list, String flag) join String res = ""; if (list != null) { StringBuilder sb = new StringBuilder(); int len = list.size(); for (int i = 0; i < len; i++) { sb.append(flag); sb.append(list.get(i)); res = sb.replace(0, 1, "").toString(); return res; |
String | join(List list, String separator) join join_sb.delete(0, join_sb.length()); for (int i = 0; i < list.size(); i++) { join_sb.append(list.get(i)); if (i < list.size() - 1) { join_sb.append(separator); return join_sb.toString(); ... |
String | join(List list, String separator) Joins string representations of all objects from list into one String Elements are converted to strings as by String.valueOf(object) StringBuilder str = new StringBuilder(); for (Object item : list) { str.append(String.valueOf(item)).append(separator); return str.substring(0, str.length() - separator.length()); |
String | join(List objects) Concatenate a list of objects into a single string (using their "toString" method), joining them with a ",". return join(",", objects); |
String | join(List objects, String joiner) join return join(objects.toArray(), joiner);
|
String | join(List strings, String delimiter) Join string pieces and separate with a delimiter. if (strings == null || delimiter == null) { return null; StringBuffer str = new StringBuffer(); int most = strings.size() - 1; if (strings.size() > 1) { Iterator iter = strings.iterator(); for (int i = 0; i < most; i++) { ... |
String | join(List vec, String separator) Return a string that contains all the list components as strings separated by the specified separator. StringBuffer buf = new StringBuffer(); if (separator == null) { separator = ""; Iterator e = vec.iterator(); while (e.hasNext()) { buf.append(e.next().toString()); if (e.hasNext()) { ... |
String | join(List extends CharSequence> items, CharSequence delimiter) join StringBuilder sb = new StringBuilder(); for (int i = 0; i < items.size(); i++) { if (i != 0) sb.append(delimiter); sb.append(items.get(i)); return sb.toString(); |
String | join(List extends CharSequence> s, String delimiter) join int capacity = 0; int delimLength = delimiter.length(); Iterator<? extends CharSequence> iter = s.iterator(); if (iter.hasNext()) { capacity += iter.next().length() + delimLength; StringBuilder buffer = new StringBuilder(capacity); iter = s.iterator(); ... |