i am very confused with this little example of java.util.PriorityQueue and my own Comparator:
In this code i get a wrong order in the queue. The result is: 5,8,7
5,8,7
A PriorityQueue doesn't store its elements in order. It gives them back to you in order.
PriorityQueue
If you called poll() three times on the PriorityQueue, you'd get your elements back in the appropriate order.
poll()