summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/immutable/List.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/collection/immutable/List.scala')
-rw-r--r--src/library/scala/collection/immutable/List.scala10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala
index b7a2908536..79be24cb3e 100644
--- a/src/library/scala/collection/immutable/List.scala
+++ b/src/library/scala/collection/immutable/List.scala
@@ -147,7 +147,7 @@ sealed abstract class List[+A] extends LinearSeq[A]
/** Create a new list which contains all elements of this list
* followed by all elements of Traversable `that'
*/
- override def ++[B >: A, That](that: Traversable[B])(implicit bf: BuilderFactory[B, That, List[A]]): That = {
+ override def ++[B >: A, That](that: Traversable[B])(implicit bf: CanBuildFrom[List[A], B, That]): That = {
val b = bf(this)
if (b.isInstanceOf[ListBuffer[_]]) (this ::: that.toList).asInstanceOf[That]
else super.++(that)
@@ -156,7 +156,7 @@ sealed abstract class List[+A] extends LinearSeq[A]
/** Create a new list which contains all elements of this list
* followed by all elements of Iterator `that'
*/
- override def ++[B >: A, That](that: Iterator[B])(implicit bf: BuilderFactory[B, That, List[A]]): That =
+ override def ++[B >: A, That](that: Iterator[B])(implicit bf: CanBuildFrom[List[A], B, That]): That =
this ++ that.toList
/** Overrides the method in Iterable for efficiency.
@@ -502,7 +502,11 @@ object List extends SeqFactory[List] {
import scala.collection.{Iterable, Seq, Vector}
- implicit def builderFactory[A]: BuilderFactory[A, List[A], Coll] = new VirtualBuilderFactory[A]
+ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, List[A]] =
+ new GenericCanBuildFrom[A] {
+ def apply() = newBuilder[A]
+ }
+
def newBuilder[A]: Builder[A, List[A]] = new ListBuffer[A]
override def empty[A]: List[A] = Nil