PriorityQueue class

A PriorityQueue is comes in the picture when we processed objects based on the priority. The PriorityQueue is based on the priority heap or ordered as per their natural ordering.

Features of PriorityQueue
1. PriorityQueue is not allowed any null element.
2. A PriorityQueue based on natural ordering and also not allowed the insertion of non-comparable objects.
3. A PriorityQueue are unbound queues in itself.

Constructors:
1. public PriorityQueue()
This Constructor creates a PriorityQueue with the default initial capacity(11) that persist elements in natural ordering.

2. public PriorityQueue(int initialCapacity)
This Constructor creates a PriorityQueue with the specified initial capacity that persist elements in natural ordering.

3. public PriorityQueue(Collection c)
This constructor is used to creates a PriorityQueue containing the elements in the specified collection.

4. public PriorityQueue(int initialCapacity, Comparator comparator) This constructor is used to creates a PriorityQueue with the specified initial capacity that persist order of its elements according to the specified comparator.

5. public PriorityQueue(SortedSet sortedSet)
This constructor is used to creates a PriorityQueue containing the elements in the specified sorted set.

6. public PriorityQueue(PriorityQueue priorityQueue)
This constructor is used to creates a PriorityQueue containing the elements in the specified priority queue.

PriorityQueue class hierarchy
public class PriorityQueue extends AbstractQueue