subtract method

  1. @useResult
KtSet<T> subtract(
  1. KtIterable<T> other
)

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

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

Implementation

@useResult
KtSet<T> subtract(KtIterable<T> other) {
  final set = toMutableSet();
  set.removeAll(other);
  return set;
}