removeFirst method Null safety

E removeFirst()
override

Removes and returns the first element of this queue.

The queue must not be empty when this method is called.

Implementation

E removeFirst() {
  if (_head == _tail) throw IterableElementError.noElement();
  _modificationCount++;
  E result = _table[_head] as E;
  _table[_head] = null;
  _head = (_head + 1) & (_table.length - 1);
  return result;
}