List of utility methods to do Collection Copy
List | copy(Collection Make a copy of the parameter. List<E> dest = new ArrayList<E>(args.size()); dest.addAll(args); return dest; |
List | copy(Collection copy @SuppressWarnings("unchecked") List<T> ret = (List<T>) provideListFor(Object.class); ret.addAll(collection); return ret; |
List | copy(final Collection copy return unmodifiableList(new ArrayList<String>(in)); |
ArrayList | copy(final Collection Returns copy of the specified list. if (collection == null) { return null; return new ArrayList<T>(collection); |
ArrayList | copy(final Collection Returns copy of the specified list. if (collection == null) { return null; return new ArrayList<T>(collection); |
Collection | copy2Collection(Object[] strs) copy Collection Collection result = null; if (strs == null) { result = new ArrayList(0); } else { result = new ArrayList(strs.length); for (int i = 0; i < strs.length; i++) { result.add(strs[i]); return result; |
void | copyColl(Collection> out, Iterable> set) copy Coll Iterator<?> it = set.iterator();
while (it.hasNext()) {
((Collection<Object>) out).add(it.next());
|
void | copyIntoCollectionFrom(Collection Copies all elements from the given Iterable into the given Collection if (collection != null && iterable != null) { for (E element : iterable) { collection.add(element); |
void | copyNSorted(final Collection extends T> source, final Collection super T> dest, final Comparator super T> order, final int n) Sorts source and adds the first n entries to dest .
final List<? extends T> src = Collections.list(Collections.enumeration(source)); Collections.sort(src, order); final Iterator<? extends T> it = src.iterator(); final int maxEntries = dest.size() + n; while (it.hasNext() && dest.size() < maxEntries) { dest.add(it.next()); |
void | copyRemainder(final T[] sourceArray, final int startIndex, final Collection Adds all elements of the given array to the collector, starting from the given index. for (int index = startIndex; index < sourceArray.length; index++) { collector.add(sourceArray[index]); |