retainAll

open override fun retainAll(elements: Collection<T>): Boolean

This method modifies the set by retaining only the elements that are present in both the set and the specified collection. Elements that are not in the collection will be removed from the set.

See also