1

How can a Parallel sequence:

Seq(1,2,3).par.map(_ +1)

be converted back to a regular sequence?

Conversion from scala parallel collection to regular collection mentions that a reduce should work but:

Seq(1,2,3).par.map(_ +1).reduce(_++_).toSeq

will not compile. There is an option of calling toArray though. But I believe there must be a better way returning back to a regular collection

I need to have a solution for 2.11.

Georg Heiler
  • 16,916
  • 36
  • 162
  • 292

1 Answers1

5

To convert par collection to seq

Seq(1,2,3).par.map(_ +1).seq
vkt
  • 1,401
  • 2
  • 20
  • 46