2012-12-14 3 views
1

ParMap (스칼라 2.9에서)에는 .values ​​메서드가없는 것 같습니다. 왜 그런가요? 특히 다음과 같은 처리 과정을 병렬로 유지하려고 할 때 어떻게해야합니까?ParMap 값 메서드 대체

myParSeq.collect{case i: Interesting => i}.groupBy(_.content).values. ... 
+2

왜 교체''.MAP (_._ 2)'와 .values' 수없는 이유는 무엇입니까? –

+0

그래도 그럴 수는 없겠지. 그것이 거기에 없었던 것에 놀랐다. – Pengin

답변

2

명백하게 감시.

Adding the missing ParMap and GenMap methods.

$ 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)