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

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -