PriorityQueue (original) (raw)
Paul Sandoz paul.sandoz at oracle.com
Fri May 15 12:45:23 UTC 2015
- Previous message: PriorityQueue
- Next message: PriorityQueue
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On May 14, 2015, at 8:17 AM, Brett Bernstein <brett.bernstein at gmail.com> wrote:
I believe the linked sequence of messages refer to the addition of a PriorityQueue constructor only taking a Comparator which was does appear in Java 1.8. Did you have a link to something regarding the a constructor taking a Collection and a Comparator (2 arguments)?
There is an old issue already logged for this:
https://bugs.openjdk.java.net/browse/JDK-6356745
Give that one can already do:
Collection c = ... Comparator cmp = ... PriorityQueue p =new PriorityQueue(c.size(), cmp); p.addAll(c);
Is there a huge need for a new constructor that accepts a collection and a comparator?
It seems a nice to have and may be marginally more efficient but AFAICT O-wise addAll and establishing the heap invariant for the entire tree that is initially unordered is the same (unless i am missing something obvious here).
Paul.
- Previous message: PriorityQueue
- Next message: PriorityQueue
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]