RFR: 8327858: Improve spliterator and forEach for single-element immutable collections [v4]

Chen Liang liach at openjdk.org
Fri Oct 11 15:49:33 UTC 2024


> Please review this patch that:
> 1. Implemented `forEach` to optimize for 1 or 2 element collections.
> 2. Implemented `spliterator` to optimize for a single element.
> 
> The default implementations for multiple-element immutable collections are fine as-is, specializing implementation doesn't provide much benefit.

Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits:

 - s'marks requests
 - Merge branch 'master' of https://github.com/openjdk/jdk into feature/imm-coll-stream
 - Add test to ensure reproducible iteration order
 - Merge branch 'master' of https://github.com/openjdk/jdk into feature/imm-coll-stream
 - Merge branch 'master' of https://github.com/openjdk/jdk into feature/imm-coll-stream
 - Use the improved form in forEach
 - Merge branch 'master' of https://github.com/openjdk/jdk into feature/imm-coll-stream
 - Null checks should probably be in the beginning...
 - mark implicit null checks
 - Merge branch 'master' of https://github.com/openjdk/jdk into feature/imm-coll-stream
 - ... and 8 more: https://git.openjdk.org/jdk/compare/7276a1be...4f1f4f1b

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

Changes: https://git.openjdk.org/jdk/pull/15834/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15834&range=03
  Stats: 128 lines in 3 files changed: 124 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/15834.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15834/head:pull/15834

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


More information about the core-libs-dev mailing list