intersect method

KtSet<T> intersect(
  1. KtIterable<T> other
)

Returns a set containing all elements that are contained by both this set and the specified collection.

The returned set preserves the element iteration order of the original collection.

Implementation

KtSet<T> intersect(KtIterable<T> other) {
  final set = toMutableSet();
  set.retainAll(other);
  return set;
}