What does the scaladoc mean when it says "All operations are guaranteed to be performed in a single-threaded manner"?

StackOverflow https://stackoverflow.com/questions/19930976

  •  30-07-2022
  •  | 
  •  

質問

Looking at the scaladoc for Traversable it says

All operations are guaranteed to be performed in a single-threaded manner.

Is that just saying "these data structures are thread-safe" or does it imply something more complex/subtle/nuanced?

役に立ちましたか?

解決

It means the thread on which the call is invoked is the one that will be used for the entire operation, even it if examines or operates on every element in the collection.

That distinguishes them from the parallel collections which will use potentially all available processors in parallel and thus multiple threads to conclude the collection operation as quickly as possible.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top