remove method

bool remove(
  1. Object? o

Removes a single instance of value from the queue.

Returns true if a value was removed, or false if the queue contained no element equal to value.


bool remove(Object? o) {
  _DoubleLinkedQueueEntry<E> entry = _sentinel._nextLink!;
  while (true) {
    var elementEntry = entry._asNonSentinelEntry();
    if (elementEntry == null) return false;
    bool equals = (elementEntry.element == o);
    if (!identical(this, elementEntry._queue)) {
      // Entry must still be in the queue.
      throw ConcurrentModificationError(this);
    if (equals) {
      return true;
    entry = entry._nextLink!;