import java.util.PriorityQueue;
PriorityQueue<Integer> pq = new PriorityQueue<>();
pq.add(123);
pq.add(456);
pq.add(789);
System.out.println(pq); // This will print [123, 456, 789]
pq.remove(); // This removes the head of the queue, i.e. 123
System.out.println(pq); // This will print [456, 789]
pq.remove(789);
System.out.println(pq); // This will print [456]