foreach - Scala Parallel Print Hanging the console -


i new scala world , trying exercises book. so, have example print vector in sequential , parallel fashion. former works , later hangs console.

code

val v = vector.range(0, 10) v.foreach(println) 

code output

0123456789 

but if use same code, instead of using foearch, use par, freezes console

val v = vector.range(0,10) v.par.foreach(println) 

the book using says output should like:

5678901234     

but hangs , program never finishes.

can explain me why?


Comments

Popular posts from this blog

r - geom_bar tied exactly to x and y axis (without aggregating) -

php - Is there a way to specify only some optional function args? -

java - Spring-boot using RestTemplate -