peek


Description:

public T peek ()

Returns the highest-priority (smallest) element without removing it. Returns null if the queue is empty.

Example:

    var pq = new PriorityQueue<string> ((a, b) => {
return strcmp (a, b);
});
pq.add ("b");
pq.add ("a");
assert (pq.peek () == "a");
assert (pq.size () == 2);

Returns:

the smallest element, or null if empty.