retainAll method

ImmortalSet<T> retainAll(
  1. ImmortalSet<Object?> other
)

Returns a copy of this set where are all elements that are not in other are removed from.

Checks for each element of other whether there is an element in this set that is equal to it (according to contains), and if so, the equal element in this set is retained in the copy, and elements that are not equal to any element in other are removed from the copy.

Implementation

ImmortalSet<T> retainAll(ImmortalSet<Object?> other) =>
    retainIterable(other.toSet());