I was trying to insert the integers in PriorityQueue:
However, the output I am getting is not in sorted order. Output after running the below code is : [1, 5, 2, 8]