summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/parallel/ParIterableView.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/collection/parallel/ParIterableView.scala')
-rw-r--r--src/library/scala/collection/parallel/ParIterableView.scala23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/library/scala/collection/parallel/ParIterableView.scala b/src/library/scala/collection/parallel/ParIterableView.scala
index dd703b5c8b..5efe87c9ee 100644
--- a/src/library/scala/collection/parallel/ParIterableView.scala
+++ b/src/library/scala/collection/parallel/ParIterableView.scala
@@ -6,6 +6,7 @@ package scala.collection.parallel
import scala.collection.Parallel
import scala.collection.TraversableViewLike
import scala.collection.IterableView
+import scala.collection.generic.CanCombineFrom
@@ -23,6 +24,28 @@ extends ParIterableViewLike[T, Coll, CollSeq, ParIterableView[T, Coll, CollSeq],
+object ParIterableView {
+ abstract class NoCombiner[T] extends Combiner[T, Nothing] {
+ self: EnvironmentPassingCombiner[T, Nothing] =>
+ def +=(elem: T): this.type = this
+ def iterator: Iterator[T] = Iterator.empty
+ def result() = throw new UnsupportedOperationException("ParIterableView.Combiner.result")
+ def size = throw new UnsupportedOperationException("ParIterableView.Combiner.size")
+ def clear() {}
+ def combine[N <: T, NewTo >: Nothing](other: Combiner[N, NewTo]) =
+ throw new UnsupportedOperationException("ParIterableView.Combiner.result")
+ }
+
+ type Coll = ParIterableView[_, C, _] forSome { type C <: ParIterable[_] }
+
+ implicit def canBuildFrom[T]: CanCombineFrom[Coll, T, ParIterableView[T, ParIterable[T], Iterable[T]]] =
+ new CanCombineFrom[Coll, T, ParIterableView[T, ParIterable[T], Iterable[T]]] {
+ def apply(from: Coll) = new NoCombiner[T] with EnvironmentPassingCombiner[T, Nothing]
+ def apply() = new NoCombiner[T] with EnvironmentPassingCombiner[T, Nothing]
+ }
+}
+
+