swap method

void swap(
  1. Deque<T> other
)

Exchanges the contents of this deque with those of other.

Implementation

void swap(Deque<T> other) {
  final temp = _queue.toList();
  _queue.clear();
  _queue.addAll(other._queue);
  other._queue.clear();
  other._queue.addAll(temp);
}