top property

T get top

Returns the top priority element without removing it. Time complexity: O(1). Throws a StateError if the queue is empty.

Implementation

T get top {
  if (empty) {
    throw StateError('Cannot access top of an empty PriorityQueue');
  }
  return _heap[0];
}