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. ------------- Commit messages: - 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 - Copyright year, revert changes for non-few element collections - Merge branch 'master' of https://github.com/openjdk/jdk into feature/imm-coll-stream - Merge branch 'feature/imm-coll-stream' of https://github.com/liachmodded/jdk into feature/imm-coll-stream - Spliterator for 12, iterate/forEach benchmark - fix comments - Remove useless implementations - Implement forEach for immutable collections - ... and 1 more: https://git.openjdk.org/jdk/compare/d451f818...8036e9e6 Changes: https://git.openjdk.org/jdk/pull/15834/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15834&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8327858 Stats: 91 lines in 2 files changed: 89 ins; 0 del; 2 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