Question: Assume the following code: Comparator String > comparator = new Comparator String > ( ) { public int compare ( String a , String b

Assume the following code:
Comparator String > comparator = new Comparator String >(){ public int compare(String a, String b){ return a.length()-b.length(); }
};
PriorityQueue=String>queue=new PriorityQueue(10,comparator);
queue.offer("abcdef");
queue.offer("abcd");
queue.offer("abcdefghi");
queue.offer("a");
queue.offer("abcdefghijklmn");
what is the order of elements in queue?
 Assume the following code: Comparator String > comparator = new Comparator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!