union method

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

Returns a set containing all distinct elements from both collections.

The returned set preserves the element iteration order of the original collection. Those elements of the other collection that are unique are iterated in the end in the order of the other collection.

Implementation

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