private static <E, F extends E, C extends Collection<F>> C collectionFilter(C collection, Iterable<? extends E> elements, Class<F> clazz) {
		for (E e : elements) {
			//if (clazz.isAssignableFrom(e.getClass()))
			if (clazz.isInstance(e))
				collection.add(clazz.cast(e));
		}
		return collection;
	}
private static <E, F extends E, C extends Collection<F>> C collectionFilter(C collection, Iterable<? extends E> elements, Class<F> clazz) {
		for (E e : elements) {
			
			if (clazz.isInstance(e))
				collection.add(clazz.cast(e));
		}
		return collection;
	}
private static < E , F extends E , C extends Collection < F > > C collectionFilter ( C collection , Iterable < ? extends E > elements , Class < F > clazz ) { for ( E e : elements ) { //if (clazz.isAssignableFrom(e.getClass()))
 if ( clazz . isInstance ( e ) ) collection . add ( clazz . cast ( e ) ) ; } return collection ; }
Assumes targetKinds and E are sensible.
Assumes targetKinds and E are sensible .