-
Sub-task
-
Resolution: Delivered
-
P4
-
9
-
Verified
Previously the default implementation of `List.spliterator` derived a `Spliterator` from the `List`'s iterator, which is poorly splitting and that affects the performance of a parallel stream returned by `List.parallelStream`.
The default implementation of `List.spliterator` now returns an optimal splitting `Spliterator` implementation for `List` implementations that implement `java.util.RandomAccess`. As a result parallel stream performance may be improved for third-party `List` implementations, such as those provided by Eclipse collections, that do not override `List.spliterator` for compatibility across multiple major versions of the Java platform.
This enhancement is a trade-off. It requires that the `List.get` method, of such lists implementing `RandomAccess`, have no side-effects, ensuring safe concurrent execution of the method when parallel stream pipeline is executed.
The default implementation of `List.spliterator` now returns an optimal splitting `Spliterator` implementation for `List` implementations that implement `java.util.RandomAccess`. As a result parallel stream performance may be improved for third-party `List` implementations, such as those provided by Eclipse collections, that do not override `List.spliterator` for compatibility across multiple major versions of the Java platform.
This enhancement is a trade-off. It requires that the `List.get` method, of such lists implementing `RandomAccess`, have no side-effects, ensuring safe concurrent execution of the method when parallel stream pipeline is executed.