Iterate over lines in a file in parallel (Scala)?

后端 未结 5 1556
遥遥无期
遥遥无期 2020-12-12 22:33

I know about the parallel collections in Scala. They are handy! However, I would like to iterate over the lines of a file that is too large for memory in parallel. I coul

5条回答
  •  误落风尘
    2020-12-12 23:09

    Below helped me to achieve

    source.getLines.toStream.par.foreach( line => println(line))
    

提交回复
热议问题