next

operator fun next(): T

Removes and returns the value at the top of this heap.

If the heap is empty, this method will throw an exception.

Example:

val heap = heapOf(1, 2, 3) { a, b -> a b }

require(heap.next() == 3)
require(heap.next() == 2)
require(heap.next() == 1)

Return

The value removed from the top of this heap.

Throws

If this method was called on an empty heap.