Mario Galic
Mario Galic

Reputation: 48400

Missing import scala.collection.parallel in Scala 2.13

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?

Upvotes: 23

Views: 6654

Answers (1)

Mario Galic
Mario Galic

Reputation: 48400

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" % "1.0.0"

and to enable .par extension method import

import scala.collection.parallel.CollectionConverters._

Corresponding scaladoc is also no longer available from 2.13 API docs but instead is published at javadoc.io/doc/org.scala-lang.modules/scala-parallel-collections_2.13.

Upvotes: 30

Related Questions