Spliterator: Thread-Safe or not?

Viewed 1029

I am looking into the documentation of the Spliterator and according to it, the Spliterator is not thread-safe:

Despite their obvious utility in parallel algorithms, spliterators are not expected to be thread-safe; instead, implementations of parallel algorithms using spliterators should ensure that the spliterator is only used by one thread at a time. This is generally easy to attain via serial thread-confinement, which often is a natural consequence of typical parallel algorithms that work by recursive decomposition.

But, in its further documentation, which states a contradictory statement to the above statement:

Structural interference of a source can be managed in the following ways (in approximate order of decreasing desirability):

The source manages concurrent modifications. For example, a key set of a java.util.concurrent.ConcurrentHashMap is a concurrent source. A Spliterator created from the source reports a characteristic of CONCURRENT.

So does that mean a Spliterator generated from a thread-safe collection would be thread-safe? Is it right?

1 Answers
Related