remove method

bool remove (E element)
override

Removes an element that compares equal to element in the queue.

Returns true if an element is found and removed, and false if no equal element is found.

Implementation

bool remove(E element) {
  int index = _locate(element);
  if (index < 0) return false;
  E last = _removeLast();
  if (index < _length) {
    int comp = comparison(last, element);
    if (comp <= 0) {
      _bubbleUp(last, index);
    } else {
      _bubbleDown(last, index);
    }
  }
  return true;
}