clear method Null safety

void clear()
override

Removes all elements in the queue. The size of the queue becomes zero.

Implementation

void clear() {
  if (_head != _tail) {
    for (int i = _head; i != _tail; i = (i + 1) & (_table.length - 1)) {
      _table[i] = null;
    }
    _head = _tail = 0;
    _modificationCount++;
  }
}