... highest-priority element of the priority queue (i.e., the head of the queue), peek to get a reference to the highest-priority element of the priority queue (without removing that element), clear to remove all elements in the priority queue and size to get the number of elements in the priority queue.
Figure 16.14 demonstrates class PriorityQueue. Line 8 creates a PriorityQueue that stores Doubles with an initial capacity of 11 elements and orders the elements according to the object’s natural ordering (the defaults for a PriorityQueue). PriorityQueue is a generic class. Line 8 instantiates a PriorityQueue with a type argument Double. Class PriorityQueue provides several additional constructors. One of these takes an int and a Comparator object to create a