Skip to content
Parallel collections standard library module for Scala 2.13+
Scala Shell
Branch: master
Clone or download
Latest commit 48df8d1 Aug 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
admin do our JDK 8 testing on OpenJDK 8 Jul 4, 2019
core/src/main/scala/scala/collection
junit/src/test/scala
project
scalacheck/src/test/scala prepare for 0.2.0 release for Scala 2.13.0-RC1 Apr 4, 2019
testmacros/src/main/scala/testutil relicense under Apache 2 (and upgrade sbt-header) Jan 9, 2019
.gitignore Initial version of parallel collections from the Scala standard library Jan 18, 2017
.travis.yml Use AdoptOpenJDK JDK 8 and 11 Jul 9, 2019
CODE_OF_CONDUCT.md
LICENSE
NOTICE
README.md Update README.md Aug 20, 2019
build.sbt support Scala 2.13 (drop 2.13.0-RC3) Jun 8, 2019

README.md

Scala parallel collections

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.

Maintenance status

This module is maintained by the Scala team at Lightbend. If you are interested in participating, please jump right in on issues and pull requests.

Usage

To depend on scala-parallel-collections in sbt, add this to your build.sbt:

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

In your code, adding this import:

import scala.collection.parallel.CollectionConverters._

will enable use of the .par method as in earlier Scala versions.

Scaladoc

Here is the full Scaladoc.

Cross-building: dependency

This module is published only for the Scala 2.13.x series, so in a cross-built project, the dependency should take this form:

libraryDependencies ++= {
  CrossVersion.partialVersion(scalaVersion.value) match {
    case Some((2, major)) if major >= 13 =>
      Seq("org.scala-lang.modules" %% "scala-parallel-collections" % "0.2.0")
    case _ =>
      Seq()
  }
}

This way of testing scalaVersion is robust across varying Scala version number formats (nightlies, milestones, release candidates, community build, etc).

Cross-building: source compatibility

Using .par is problematic in a cross-built project, since in Scala 2.13 the CollectionConverters._ import shown above is necessary, but in earlier Scala versions, that import will not compile.

You may able to avoid the problem by directly constructing your parallel collections rather than going through .par. For other possible workarounds, see https://github.com/scala/scala-parallel-collections/issues/22, which is still under discussion.

Releasing

As with other Scala standard modules, build and release infrastructure is provided by the sbt-scala-modules sbt plugin.

You can’t perform that action at this time.