List of utility methods to do List Concatenate
byte[] | concatenateFileContent(List concatenate File Content int length = 0; for (byte[] content : fileContents) { length += content.length; byte[] mergedFileContents = new byte[length]; int destPos = 0; for (byte[] fileContent : fileContents) { System.arraycopy(fileContent, 0, mergedFileContents, destPos, fileContent.length); ... |
int[] | ConcatenateInt(List Concatenate all the arrays in the list into a vector. int size = 0; for (int i = 0; i < arrays.size(); i++) { size += arrays.get(i).length; int[] all = new int[size]; int idx = 0; for (int i = 0; i < arrays.size(); i++) { int[] v = arrays.get(i); ... |
String | concatenateList(List values) Concatenates a bunch of header values, seperating them with a comma. StringBuffer buf = new StringBuffer(); for (int i = 0, size = values.size(); i < size; ++i) { buf.append(((String) values.get(i)).replaceAll("\n", "").trim()); if (i != (size - 1)) { buf.append(","); return buf.toString(); ... |
String | concatenateList(List extends Object> list, String separator) Concatenates the list of Objects using the provided separator if (list == null || list.isEmpty()) { return ""; StringBuilder result = new StringBuilder(); for (int i = 0; i < list.size() - 1; i++) { result.append(list.get(i) + separator); result.append(list.get(list.size() - 1)); ... |
String | concatenateListOfStrings(List concatenate List Of Strings StringBuffer buff = new StringBuffer(); for (String s : list) { buff.append(s).append(separator); return buff.toString(); |
List | concatenateLists(List... lists) concatenate Lists int len = 0; for (List l : lists) { len += l.size(); List<String> result = new ArrayList<String>(len); for (List l : lists) { for (Object o : l) { if (!(o instanceof String)) { ... |
String | concatenateParameters(List concatenate Parameters StringBuilder str = new StringBuilder(); boolean first = true; for (String parameter : parameters) { if (first) first = false; else str.append(" "); str.append(parameter); ... |
String | concatenateStrings(List Concatenate the Strings in the List, putting the separator between each but not after the last. String result = ""; if (strings != null && !strings.isEmpty()) { StringBuilder sb = new StringBuilder(); for (String s : strings) { sb.append(s).append(separator); result = sb.toString(); result = result.substring(0, result.length() - separator.length()); ... |
List | concatenateUniqueLists(List first, List second) Return a new List with no duplicated values. List concatenation = new ArrayList(first.size() + second.size()); concatenation.addAll(first); for (Object element : second) { if (!concatenation.contains(element)) { concatenation.add(element); return concatenation; ... |
String | concatGenericList(List> list, String delimiter) Concatenate a list of objects into a single string. StringBuilder ret = new StringBuilder(); boolean first = true; for (Object s : list) { if (!first) { ret.append(delimiter); ret.append("" + s); first = false; ... |