List of utility methods to do ArrayList Join
String | join(ArrayList> list, String delimeter) Folds the list into a string, putting the delimeter in between each element of the collection. StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.size() - 1; i++) { sb.append(list.get(i).toString()).append(delimeter); return sb.append(list.get(list.size() - 1).toString()).toString(); |
String | join(ArrayList join if (separator == null) { separator = ","; StringBuilder sb = new StringBuilder(); for (int i = 0; i < arr.size(); i++) { if (i > 0) { sb.append(separator); sb.append(arr.get(i).toString()); return sb.toString(); |
String | Join(ArrayList Join if (coll.isEmpty()) return ""; StringBuilder sb = new StringBuilder(); for (String x : coll) sb.append(x + delimiter); sb.delete(sb.length() - delimiter.length(), sb.length()); return sb.toString(); |
String | join(ArrayList join if ((list == null) || (list.size() == 0)) return ""; StringBuilder sb = new StringBuilder(); boolean first = true; for (String item : list) { if (first) first = false; else ... |
String | join(ArrayList join StringBuilder stringBuilder = new StringBuilder(); Iterator<String> iterator = list.iterator(); while (iterator.hasNext()) { stringBuilder.append(iterator.next()); if (!iterator.hasNext()) break; stringBuilder.append(delimiter); return stringBuilder.toString(); |
String | Join(ArrayList This method converts a list of String objects to a single String representation and inserts a delimiter between each object. if (list.isEmpty()) return ""; StringBuilder sb = new StringBuilder(); for (String x : list) sb.append(x + delimiter); sb.delete(sb.length() - delimiter.length(), sb.length()); return sb.toString(); |
String | join(ArrayList join StringBuilder sb = new StringBuilder(); int i = 0; int size = list.size(); for (String part : list) { i++; sb.append(part); if (i != size) { sb.append(joinChar); ... |
String | join(ArrayList Join.
String string; StringBuilder builder; if (nameList == null || nameList.isEmpty()) return ""; Iterator<String> iter = nameList.iterator(); string = iter.next(); if (string.equals("")) { builder = new StringBuilder(iter.next()); ... |
String | join(ArrayList join StringBuilder buffer = new StringBuilder(); for (int i = 0; i < s.size(); i++) { if (i != 0) buffer.append(delimiter); buffer.append(s.get(i)); return buffer.toString(); |
String | join(ArrayList Join an array StringBuffer sb = new StringBuffer(); for (int i = 0; i < strings.size(); i++) { if (i != 0) sb.append(separator); sb.append(strings.get(i)); return sb.toString(); |