ParMap(在 Scala 2.9 中)似乎没有 .values 方法。为什么会这样,如果我特别热衷于维护如下的并行处理链,我该如何解决?
myParSeq.collect{case i: Interesting => i}.groupBy(_.content).values. ...
ParMap(在 Scala 2.9 中)似乎没有 .values 方法。为什么会这样,如果我特别热衷于维护如下的并行处理链,我该如何解决?
myParSeq.collect{case i: Interesting => i}.groupBy(_.content).values. ...
显然是疏忽。
$ scala
Welcome to Scala version 2.10.0-RC2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_06).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import collection.parallel.immutable._
import collection.parallel.immutable._
scala> ParMap("a"->1)
res0: scala.collection.parallel.immutable.ParMap[String,Int] = ParMap(a -> 1)
scala> res0.values
res1: scala.collection.parallel.ParIterable[Int] = ParIterable(1)
怎么样:
$ scala29
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_22).
Type in expressions to have them evaluated.
Type :help for more information.
scala> Map("a"->1, "b"->2).par
res0: scala.collection.parallel.immutable.ParMap[java.lang.String,Int] = ParMap(a -> 1, b -> 2)
scala> .unzip._2
res1: scala.collection.parallel.immutable.ParIterable[Int] = ParVector(1, 2)