Scala 2.13之后,并行模块变成了外部库需要在maven项目的pom.xml中手动导入:
<dependency>
<groupId>org.scala-lang.modules</groupId>
<artifactId>scala-parallel-collections_2.13</artifactId>
<version>0.2.0</version>
</dependency>
然后在代码文件中导入如下的包就行了:
import scala.collection.parallel.CollectionConverters._
import scala.collection.parallel.immutable._
...
val parList = List(1,2,3).par