Integrated: 8327858: Improve spliterator and forEach for single-element immutable collections

Chen Liang liach at openjdk.org
Fri Apr 4 01:02:11 UTC 2025


On Wed, 20 Sep 2023 04:52:31 GMT, Chen Liang <liach at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 1c2a5533
Author:    Chen Liang <liach at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/1c2a5533f4e8926db18365eb510588594f8fb6ba
Stats:     126 lines in 3 files changed: 124 ins; 0 del; 2 mod

8327858: Improve spliterator and forEach for single-element immutable collections

Reviewed-by: smarks, vklang

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

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


More information about the core-libs-dev mailing list