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
Post a Comment