removeAll method

  1. @override
Iterable<E> removeAll()
override

Removes all the elements from this queue and returns them.

The returned iterable has no specified order. The operation does not copy the elements, but instead keeps them in the existing heap structure, and iterates over that directly.

Implementation

@override
Iterable<E> removeAll() {
  _modificationCount++;
  var result = _queue;
  var length = _length;
  _queue = const [];
  _length = 0;
  return result.take(length).cast();
}