src/main/java/com/workplacesystems/utilsj/collections/helpers/CollectionUtilities.java
public static<T> Collection<T> like(Collection<T> source)
    {
        // known concrete types
        if (source instanceof FilterableArrayList)
            return new FilterableArrayList();
        if (source instanceof ArrayList)
            return new ArrayList();
        if (source instanceof LinkedList)
            return new LinkedList();
        if (source instanceof TreeSet)
            return new TreeSet(((TreeSet)source).comparator());
        if (source instanceof LinkedHashSet)
            return new LinkedHashSet();
        if (source instanceof HashSet)
            return new HashSet();
        if (source instanceof Stack)
            return new Stack();
        if (source instanceof PriorityQueue)
            return new PriorityQueue(10, ((PriorityQueue)source).comparator());
        if (source instanceof Vector)
            return new Vector();
        
        // known abstract types
        if (source instanceof Queue)
            return new LinkedList();
        if (source instanceof SortedSet)
            return new TreeSet(((SortedSet)source).comparator());
        if (source instanceof Set)
            return new HashSet();
        if (source instanceof List)
            return new ArrayList();
        
        throw new IllegalArgumentException("Unknown collection type " + source.getClass().getCanonicalName());
    }
public static<T> Collection<T> like(Collection<T> source)
    {
        // known concrete types
        if (source instanceof FilterableArrayList)
            return new FilterableArrayList();
        if (source instanceof ArrayList)
            return new ArrayList();
        if (source instanceof LinkedList)
            return new LinkedList();
        if (source instanceof TreeSet)
            return new TreeSet(((TreeSet)source).comparator());
        if (source instanceof LinkedHashSet)
            return new LinkedHashSet();
        if (source instanceof HashSet)
            return new HashSet();
        if (source instanceof Stack)
            return new Stack();
        if (source instanceof PriorityQueue)
            return new PriorityQueue(10, ((PriorityQueue)source).comparator());
        if (source instanceof Vector)
            return new Vector();
        
        // known abstract types
        if (source instanceof Queue)
            return new LinkedList();
        if (source instanceof SortedSet)
            return new TreeSet(((SortedSet)source).comparator());
        if (source instanceof Set)
            return new HashSet();
        if (source instanceof List)
            return new ArrayList();
        
        throw new IllegalArgumentException("Unknown collection type " + source.getClass().getCanonicalName());
    }
New empty collection with similar type to source.  The known concrete types replicated exactly are
{@link ArrayList}, {@link LinkedList}, {@link TreeSet}, {@link HashSet}, {@link Stack}, {@link Stack},
{@link PriorityQueue}, {@link LinkedHashSet}, {@link Vector}.
<p>
Otherwise, the method only guarantees common conformance to one of the abstractions
{@link Queue}, {@link SortedSet}, {@link Set}, {@link List}.