poll method

Object? poll()

Remove the smallest item from the priority queue. @return the smallest item, or null if empty

Implementation

Object? poll() {
  if (isEmpty()) return null;
  Object minItem = _items[1];
  _items.insert(1, _items[_size]);
  _size -= 1;
  reorder(1);

  return minItem;
}