In a method I receive a generic object E extends Comparable<E> as an argument. Now i want to create two priority queues.One which uses the comparator used by E and other queue which uses the opposite of comparator used by E(i.e. if E uses ‘<‘ then second queue must use ‘>=’).
Please hep me how to create two such queues.
queue2=new PriorityQueue<E>(0,Collections.reverseOrder(e));
I am getting the error that reverseOrder is not applicable.
please help
Look at Collections.reverseOrder.