swap method

void swap(
  1. SortedMap<K, V> other
)

Exchanges the contents of this map with those of other.

Implementation

void swap(SortedMap<K, V> other) {
  final temp = Map<K, V>.of(_container);
  _container.clear();
  _container.addAll(other._container);
  other._container.clear();
  other._container.addAll(temp);
}