Missing import scala.collection.parallel in Scala 2.13

自作多情 提交于 2019-11-28 03:10:52

问题


Parallel collections in Scala 2.12 were importable out-of-the-box like so

import scala.collection.parallel.immutable.ParVector
val pv = new ParVector[Int]

however why in Scala 2.13 package scala.collection.parallel seems to be missing?


回答1:


Parallel collections have been moved in Scala 2.13 to separate module scala/scala-parallel-collection

This Scala standard module contains the package scala.collection.parallel, with all of the parallel collections that used to be part of the Scala standard library.

For Scala 2.13, this module is a separate JAR that can be omitted from projects that do not use parallel collections.

thus from 2.13 onwards we need the following dependency

libraryDependencies += "org.scala-lang.modules" %% "scala-parallel-collections" % "0.2.0"

And in the program we need to:

import scala.collection.parallel.CollectionConverters._

Corresponding scaladoc is also no longer available from 2.13 API docs for which there is an open issue publish the Scaladoc somewhere #27.



来源:https://stackoverflow.com/questions/56542568/missing-import-scala-collection-parallel-in-scala-2-13

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!