The output of Fig. 16.14 shows that Priority-Queue orders Double elements in ascending order. Rewrite Fig. 16.14

Question:

The output of Fig. 16.14 shows that Priority-Queue orders Double elements in ascending order. Rewrite Fig. 16.14 so that it orders Double elements in descending order (i.e., 9.8 should be the highest-priority element rather than 3.2).

Fig. 16.14

1 // Fig. 16.14: PriorityQueueTest.java 2 // PriorityQueue test program. 3 import java.util.PriorityQueue; 4

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: