JDK Spliterator with Parallel Processing

I have created a fixed size Spliterator to split the collection into fixed size. https://github.com/openjdk/jdk/pull/2907 It's working as expected. With a collection of size greater than the threshold, it would trySplit and generate a new Spliterator. And if the stream is parallel, it would pass the spliterator to different threads.

however, when trying to group the elements by thread, below code is not always working

Map<String, List<Integer>> partition = new ForkJoinPool(10).submit( () ->StreamSupport.stream(new…