swap method

void swap(
  1. SortedSet<T> other
)

Exchanges the contents of this set with those of other.

Implementation

void swap(SortedSet<T> other) {
  final temp = _container.toSet();
  _container.clear();
  _container.addAll(other._container);
  other._container.clear();
  other._container.addAll(temp);
}