I have a collection on which I call .par
, like this:
myCollection.par.map(element => longRunningOperation(element)).seq
println("after map")
Will calling .seq
guarantee all threads are joined before continuing, and all maps completed, before calling println?
The worker threads are launched once the map
operation is invoked. They are all joined by the framework before the map
operation completes. By the time you call seq
there are no more running worker threads.