summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-06-21 17:20:39 +0000
committerPaul Phillips <paulp@improving.org>2011-06-21 17:20:39 +0000
commit5c416166c22abfb5ca0a595b468844708dcdaa45 (patch)
treec8156556a6dd02a0645886f1f29591dcb4c1d8c5 /src/library
parentd4f8dc660a9b17b30b7c6b909b5a15d028ce7c37 (diff)
downloadscala-5c416166c22abfb5ca0a595b468844708dcdaa45.tar.gz
scala-5c416166c22abfb5ca0a595b468844708dcdaa45.tar.bz2
scala-5c416166c22abfb5ca0a595b468844708dcdaa45.zip
Routed Stream.+: through cons to avoid some tru...
Routed Stream.+: through cons to avoid some truly pathological performance. Closes #4697, no review.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/collection/immutable/Stream.scala4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala
index 95ffaf5a3e..5f90202522 100644
--- a/src/library/scala/collection/immutable/Stream.scala
+++ b/src/library/scala/collection/immutable/Stream.scala
@@ -146,6 +146,10 @@ self =>
)
else super.++(that)(bf)
+ override def +:[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Stream[A], B, That]): That =
+ if (isStreamBuilder(bf)) asThat(cons(elem, this))
+ else super.+:(elem)(bf)
+
/**
* Create a new stream which contains all intermediate results of applying the operator
* to subsequent elements left to right.