List of utility methods to do Collection Concatenate
Collection | concat(Collection concat if (collections == null || collections.length == 0) { return Collections.emptyList(); if (collections.length == 1) { return collections[0]; return concat(Arrays.asList(collections)); |
List | concat(final Collection Concatenates all the given collections together (order is conserved). final List<T> concatenation = new ArrayList<T>(); for (final Collection<T> collection : collections) { if (collection != null) { concatenation.addAll(collection); return concatenation; |
List | concat(final Collection concat final List<T> concatenation = new ArrayList<T>(); for (final Collection<T> collection : collections) { if (collection != null) { concatenation.addAll(collection); return concatenation; |
String | concat(String separator, Collection args) concat StringBuilder sb = new StringBuilder(); for (Object arg : args) { sb.append(separator).append(arg); if (sb.length() > 0) { sb.delete(0, separator.length()); return sb.toString(); ... |
String[] | concat(String[] first, Collection concat String[] array = Arrays.copyOf(first, first.length + second.size()); Iterator<String> it = second.iterator(); for (int i = first.length; i < array.length; i++) array[i] = it.next(); return array; |
String | concatCollection(Collection Converts a collection of Strings into one long String. StringBuilder sb = new StringBuilder(collection.size()); for (String s : collection) { sb.append(String.valueOf(s)); return sb.toString(); |
StringBuilder | concatElements(final Collection> c, final String separator) Joins the String representations of the elements of a given Collection using a given separator. final StringBuilder builder = new StringBuilder(); if (c.isEmpty()) { return builder; final Iterator<?> oIterator = c.iterator(); builder.append(oIterator.next()); while (oIterator.hasNext()) { builder.append(separator).append(oIterator.next()); ... |
Collection | concatenate(Collection collections) concatenate ArrayList concatenation = new ArrayList(); for (Iterator i = collections.iterator(); i.hasNext();) { Collection collection = (Collection) i.next(); concatenation.addAll(collection); return concatenation; |
String | concatenate(Collection> coll) concatenate StringBuilder sb = new StringBuilder(); Iterator<?> it = coll.iterator(); while (it.hasNext()) { sb.append(it.next()); if (it.hasNext()) { sb.append(' '); return sb.toString(); |
String | concatenate(Collection> list) concatenate return concatenate(list, DEFAULT_DELIMITER);
|