a priority queue is implemented as a max-heap initially it has 5 elements code example
Example: priority queue max heap in java
PriorityQueue<Integer> queue = new PriorityQueue<>(10, Collections.reverseOrder());
PriorityQueue<Integer> pq =new PriorityQueue<>((x, y) -> Integer.compare(y, x));
PriorityQueue<Integer> pq = new PriorityQueue<Integer>(defaultSize, new Comparator<Integer>() {
public int compare(Integer lhs, Integer rhs) {
if (lhs < rhs) return +1;
if (lhs.equals(rhs)) return 0;
return -1;
}
});