In a method I receive a generic object E extends Comparable as an argument. Now i want to create two priority queues.One which uses the comparato
object E extends Comparable
comparato
The single argument of Collections.reverseOrder is a Comparator and not a Collection. For your code simply use reverseOrder without an argument. You have to use a non-zero inital size, too. The following code will work.
queue2=new PriorityQueue(1, Collections.reverseOrder());