问题
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