Skip to main content
The 2024 Developer Survey results are live! See the results
add another solution (which should be the solution)
Source Link

If you add par then you will get a parallel collection and operations on it will be processed in parallel. To convert back to a normal collection call a toList.

So your code would look like:

a.par.map(tup => tup._1 + tup._2).toList

Or a .seq to get a Sequential Collection (the opposite of a Parallel Collection).

a.par.map(tup => tup._1 + tup._2).seq

Also, check the documentation.

If you add par then you will get a parallel collection and operations on it will be processed in parallel. To convert back to a normal collection call a toList.

So your code would look like:

a.par.map(tup => tup._1 + tup._2).toList

Also, check the documentation.

If you add par then you will get a parallel collection and operations on it will be processed in parallel. To convert back to a normal collection call a toList.

So your code would look like:

a.par.map(tup => tup._1 + tup._2).toList

Or a .seq to get a Sequential Collection (the opposite of a Parallel Collection).

a.par.map(tup => tup._1 + tup._2).seq

Also, check the documentation.

added 68 characters in body
Source Link

If you add par then you will get a ParSeqparallel collection and operations on it will be processed in parallel. To convert back to a normal collection withcall a toList.

So your code would look like:

a.par.map(tup => tup._1 + tup._2).toList

Also, check the documentation.

If you add par then you will get a ParSeq convert back to a normal collection with a toList.

So your code would look like:

a.par.map(tup => tup._1 + tup._2).toList

Also, check the documentation.

If you add par then you will get a parallel collection and operations on it will be processed in parallel. To convert back to a normal collection call a toList.

So your code would look like:

a.par.map(tup => tup._1 + tup._2).toList

Also, check the documentation.

Source Link

If you add par then you will get a ParSeq convert back to a normal collection with a toList.

So your code would look like:

a.par.map(tup => tup._1 + tup._2).toList

Also, check the documentation.