C (Iterable<? extends V> seq) { if (myEmptyCollection instanceof Set && seq instanceof Set) { return (C)seq; } if (myEmptyCollection instanceof List && seq instanceof List) { return (C)seq; } return Iterators.collect(seq, myCollectionFactory.get()); }