On Wed, 8 Jul 2026 21:17:06 GMT, Viktor Klang <[email protected]> wrote:
>> Thanks, I think there may be a small confusion here. >> >> The exact `PriorityQueue` check is only for the receiver. >> The source collection `c` can still be any `Collection`, so >> `prepareElements` is still needed there. >> >> I agree with the refactoring suggestion, though. I will fold the >> `initElementsFromArray` logic into the callers and remove that helper. > > Ah, yes, good point. So that means that if we check the exact type of `c` > then we can trust its `isEmpty()` (need to amend that) and as well not have > to check for null elements. So adding a Pq to a PQ should then be as optimal > as can be. Agreed. Thanks for pointing out that. I've added a separate fast path for exact `PriorityQueue` sources. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31701#discussion_r3547456820
