Here is My Code
import java.util.*;
public class PriorityPuzzle{
public static void main(String []args){
PriorityQueue<Integer> prq = new PriorityQueue<Integer>();
for ( int i = 10; i > 0; i-- ){
prq.add (i);
System.out.print(i+" , ");
}
System.out.println ( "\n Initial priority queue values are: "+ prq);
}
}
Result
I donnot know why the after Priority the queue become {1,2,5,4,3,9,6,10,7,8}