On Fri, 1 Nov 2024 10:13:15 GMT, kabutz <d...@openjdk.org> wrote:

> Since Java 10, spliterators for the ConcurrentSkipListMap were pointing to 
> the head, which has item == null, rather than to the first element. The 
> trySplit() method no longer worked, and always returned null. Therefore, 
> parallel streams have not worked for ConcurrentSkipListMap and 
> ConcurrentSkipListSet since Java 10. It worked correctly in Java 8 and 9.
> 
> The problem lies in the constructor calls for the various spliterators. In 
> Java 9, we pass in head.node.next as "origin" into the  constructor. In Java 
> 10, this was changed to just head.node as "origin". Since the "item" field is 
> always null on head.node, we never enter the first if() statement in the 
> trySplit() method and thus it always returns null.

This pull request has now been integrated.

Changeset: 2b57f402
Author:    Dr Heinz M. Kabutz <he...@javaspecialists.eu>
Committer: Viktor Klang <vkl...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/2b57f402c46104d4aba784a891ba90604f5e9e4c
Stats:     40 lines in 2 files changed: 31 ins; 0 del; 9 mod

8343426: ConcurrentSkipListMap.spliterator() can no longer split the stream

Co-authored-by: Doug Lea <d...@openjdk.org>
Reviewed-by: vklang

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

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

Reply via email to