diff options
Diffstat (limited to 'src/library/scala/collection/parallel/package.scala')
-rw-r--r-- | src/library/scala/collection/parallel/package.scala | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/library/scala/collection/parallel/package.scala b/src/library/scala/collection/parallel/package.scala index cddf098966..c0379b819e 100644 --- a/src/library/scala/collection/parallel/package.scala +++ b/src/library/scala/collection/parallel/package.scala @@ -21,6 +21,10 @@ package object parallel { else sz } + def unsupported(msg: String) = throw new UnsupportedOperationException(msg) + + def unsupported = throw new UnsupportedOperationException + /** An implicit conversion providing arrays with a `par` method, which * returns a parallel array. * @@ -28,8 +32,8 @@ package object parallel { * @param array the array to be parallelized * @return a `Parallelizable` object with a `par` method */ - implicit def array2ParallelArray[T <: AnyRef](array: Array[T]) = new Parallelizable[mutable.ParallelArray[T]] { - def par = mutable.ParallelArray.handoff[T](array) + implicit def array2ParArray[T <: AnyRef](array: Array[T]) = new Parallelizable[mutable.ParArray[T]] { + def par = mutable.ParArray.handoff[T](array) } implicit def factory2ops[From, Elem, To](bf: CanBuildFrom[From, Elem, To]) = new { @@ -42,12 +46,12 @@ package object parallel { implicit def traversable2ops[T](t: TraversableOnce[T]) = new { def isParallel = t.isInstanceOf[Parallel] - def isParallelIterable = t.isInstanceOf[ParallelIterable[_]] - def asParallelIterable = t.asInstanceOf[ParallelIterable[T]] - def isParallelSeq = t.isInstanceOf[ParallelSeq[_]] - def asParallelSeq = t.asInstanceOf[ParallelSeq[T]] - def ifParallelSeq[R](isbody: ParallelSeq[T] => R) = new { - def otherwise(notbody: => R) = if (isParallel) isbody(asParallelSeq) else notbody + def isParIterable = t.isInstanceOf[ParIterable[_]] + def asParIterable = t.asInstanceOf[ParIterable[T]] + def isParSeq = t.isInstanceOf[ParSeq[_]] + def asParSeq = t.asInstanceOf[ParSeq[T]] + def ifParSeq[R](isbody: ParSeq[T] => R) = new { + def otherwise(notbody: => R) = if (isParallel) isbody(asParSeq) else notbody } } |