Scala.collection.parallel.immutable

I am trying to find the area of a triangle given 3 sets of coordinates in hackerrank.

When I am trying to
import scala.collection.immutable._ or
scala.collection.mutable._
I am getting the below error.
error: object parallel is not a member of package collection.

Can someone help me please.

Can you give more details? That error surely needs to be coming from some other line of code than the one you’ve shown, and it’s hard for us to help without more information about what you’re trying to do…

Perhaps the problem is this:

As of Scala 2.13, the parallel collections are in a separate library; they aren’t on the classpath by default.

(In Scala 2.11 and 2.12, they were part of the standard library, so a lot of Scala books and online learning materials still assume that.)

The Maven coordinates for the dependency are: "org.scala-lang.modules" %% "scala-parallel-collections" % "0.2.0" (at least, 0.2.0 is the latest version at the time I’m writing)

1 Like