List of utility methods to do List Join
String | join(String separator, List join if (parts.isEmpty()) { return ""; StringBuilder result = new StringBuilder(); result.append(parts.get(0)); for (int i = 1; i < parts.size(); i++) { result.append(separator).append(parts.get(i)); return result.toString(); |
String | join(String separator, List join StringBuilder result = new StringBuilder(); for (String part : parts) { if (!isNullOrEmpty(part)) { if (result.length() > 0) { result.append(separator); result.append(part); return result.toString(); |
String | join(String sign, List join StringBuilder builder = new StringBuilder(); if (src != null) { for (T string : src) { builder.append(string).append(sign); if (builder.lastIndexOf(sign) > 0) { builder.delete(builder.lastIndexOf(sign), builder.length()); return builder.toString(); |
String | join(String[] elementList, String separator) Join the given element list with the specified separator StringBuffer b = new StringBuffer(); for (int i = 0; i < elementList.length - 1; i++) { b.append(elementList[i]); b.append(separator); b.append(elementList[elementList.length - 1]); return b.toString(); |
String | join(String[] list, String separator) Join the elements of an array of strings with a separator. return join(Arrays.asList(list), separator);
|
String | join(T delimiter, List join StringBuilder sb = new StringBuilder(); if (list != null && !list.isEmpty()) { for (int i = 0; i < list.size(); i++) { sb.append(list.get(i)); if (i <= list.size() - 1) sb.append(delimiter); return sb.toString(); |
List | join(T element, List Joins all given elements in a single (flat) List. final List<T> result = new ArrayList<>(); result.add(element); result.addAll(otherElements); return result; |
String | joinAndQuote(char joinChar, char quoteChar, List join And Quote StringBuilder sb = new StringBuilder(); for (int i = 0; i < strings.size(); ++i) { sb.append(quoteChar); sb.append(strings.get(i)); if (i + 1 < strings.size()) { sb.append(joinChar); sb.append(quoteChar); ... |
String | joinArray(List Transforms list into a string. StringBuilder result = new StringBuilder(); boolean first = true; for (T element : list) { if (first) { first = false; } else { result.append(separator); result.append(element); return result.toString(); |
String | joinArrayString(List join Array String StringBuilder buffer = new StringBuilder(""); for (String value : values) { buffer.append(value); return buffer.toString(); |