1. PriorityQueue does NOT permit insertion of non-comparable objects (doing so may result in ClassCastException).
2. The Iterator provided in method iterator() is NOT guaranteed to traverse the elements of the PriorityQueue in any particular order.
If you want selecting or printing elements from PriorityQueue in order according their priority, use peek() or poll() method.
Printing PriorityQueue elements with Iterator or like in your example only using