import java.util.PriorityQueue;

class TestJavaPriorityQueue {

  static public void main(String[] args) {
    PriorityQueue<Integer> pq = new PriorityQueue<Integer>(10);
    pq.offer(87);
    pq.offer(2);
    pq.offer(10);
    pq.offer(5);
    System.out.println("The elements will be processed in this order:");
    System.out.print(pq.remove());
    while (!pq.isEmpty()) {
      System.out.print(", " + pq.remove());
    }
    System.out.println();
  } // end main
} // end TestJavaPriorityQueue