RFR: 6356745: (coll) Add PriorityQueue(Collection, Comparator) [v6]
jmehrens
duke at openjdk.org
Wed Jan 3 20:39:22 UTC 2024
On Sat, 30 Dec 2023 20:51:43 GMT, Chen Liang <liach at openjdk.org> wrote:
>I think this ticket should focus on adding the new constructor as part of the API.
Okay. I would think the code would avoid heapify when the caller does foolish things with this API such as:
SortedSet ss = filledSortedSet();
PriorityQueue pq1 = new PriorityQueue(ss.comparator(), ss);
PriorityQueue pq = filledPriorityQueue();
PriorityQueue pq2 = new PriorityQueue(pq.comparator(), pq);
I assume this constructor is going to be added to TreeSet, PriorityBlockingQueue, and ConcurrentSkipListSet?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17045#issuecomment-1875939913
More information about the core-libs-dev
mailing list