Added a fast path for `PriorityQueue#addAll` when adding elements to an empty, 
exact `PriorityQueue` instance.

Instead of inserting each element one by one through `AbstractQueue#addAll`,
the implementation now copies the source collection into the backing array and 
calls `heapify()`.
This reduces the construction cost for bulk insertion into an empty queue from 
repeated per-element sift-up work to linear-time heap construction.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - Remove redundant changes
 - Drop atomicity guarantee
 - Remove redundant messages
 - 8387257:  Add fath path for PriorityQueue#addAll

Changes: https://git.openjdk.org/jdk/pull/31701/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31701&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8387257
  Stats: 103 lines in 2 files changed: 100 ins; 1 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/31701.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/31701/head:pull/31701

PR: https://git.openjdk.org/jdk/pull/31701

Reply via email to