peekNext

fun peekNext(): T

Returns the value at the top of this heap without removing it.

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

Example:

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

require(heap.peekNext() == 3)
require(heap.peekNext() == 3)

Return

The value at the top of this heap.

Throws

If this method was called on an empty heap.