pop method

E pop()

Removes and returns the last/largest value from this heap.

Implementation

E pop() {
  _checkNotEmpty();
  final value = _values.removeLast();
  if (_values.isNotEmpty) {
    final result = _values[0];
    _values[0] = value;
    _siftUp(0);
    return result;
  }
  return value;
}