List of utility methods to do Collection Copy
Collection | copyStringCollection(Collection copy String Collection if (strings == null) { return null; Collection<String> result = new ArrayList<String>(strings.size()); result.addAll(strings); return result; |
ArrayList | copyWithoutNull(Collection copy Without Null ArrayList<E> ret = new ArrayList<E>(); if (orig == null) return ret; for (E e : orig) { if (e != null) ret.add(e); return ret; ... |
Set | createSet(Collection toCopy) create Set return new HashSet(toCopy); |
Collection extends T> | maskedCopyOf(final Collection extends T> source, final Collection extends T> mask) masked Copy Of final Collection<T> copy = new LinkedList<T>(source); copy.retainAll(new ArrayList<T>(mask)); return copy; |
Collection | shallowCopy(Collection shallow Copy ArrayList<T> copied = new ArrayList<T>(collection.size()); for (T element : collection) { copied.add(element); return copied; |
List | toUnmodifiableCopy(Collection to Unmodifiable Copy return Collections.unmodifiableList(new ArrayList<T>(collection)); |