W3cubDocs

/Dart 2

remove method

bool remove (Object o)

Remove 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.

Implementation

bool remove(Object o) {
  _DoubleLinkedQueueEntry<E> entry = _sentinel._nextLink;
  while (!identical(entry, _sentinel)) {
    bool equals = (entry._element == o);
    if (!identical(this, entry._queue)) {
      // Entry must still be in the queue.
      throw new ConcurrentModificationError(this);
    }
    if (equals) {
      entry._remove();
      _elementCount--;
      return true;
    }
    entry = entry._nextLink;
  }
  return false;
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-collection/DoubleLinkedQueue/remove.html