On Thu, 4 Jan 2024 14:21:54 GMT, Valeh Hajiyev <d...@openjdk.org> wrote:

> why do you think the code would avoid heapify? `initFromCollection` method 
> will be called regardless of the type of the collection passed, which will 
> heapify the queue.

I simply mean to point out:

1.  That if the given comparator and the sortedset/priority queue comparator 
are the same then the call to heapify should be avoided as this is what is done 
in the [copy 
constructor.](https://github.com/openjdk/jdk/blob/139abc453f9eeeb4763076298ec44573ab94a3b6/src/java.base/share/classes/java/util/PriorityQueue.java#L196)
2. This new API has an anti-pattern not present with the other constructors.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17045#issuecomment-1877297438

Reply via email to