val data :Seq[Something] = ...
val transformed = data.par.map transform toList
val sorted = transformed.sortWith(...)
How can I get rid of the toList
when sorting par sequences?
If you're asking whether there is a parallel sorting implementation for parallel collections in the standard library, the answer is no. If you just want to get rid of the toList
, I suggest .seq
.
In terms of performance, there i no penalty to go from a parallel collection to a seq. Take a look here for more detail. Also if you check at the implementation you can see that .seq
returns the arrayseq
which is the main structure storing the elements in the ParArray, without any modification.