public static boolean retainAll ( Iterable < ? > removeFrom , Collection < ? > elementsToRetain ) { return ( removeFrom instanceof Collection ) ? ( ( Collection < ? > ) removeFrom ) . retainAll ( checkNotNull ( elementsToRetain ) ) : Iterators . retainAll ( removeFrom . iterator ( ) , elementsToRetain ) ; }
Removes from an iterable every element that does not belong to the provided collection .