> 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).
Daisuke Yamazaki has updated the pull request incrementally with three additional commits since the last revision: - Clarify null-check comment in prepareElements - Avoid duplicate argument checks in addAll - Change modCount place and remove this access ------------- Changes: - all: https://git.openjdk.org/jdk/pull/31701/files - new: https://git.openjdk.org/jdk/pull/31701/files/39e641dc..69613426 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=31701&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=31701&range=04-05 Stats: 14 lines in 1 file changed: 5 ins; 6 del; 3 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
