summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@typesafe.com>2016-05-23 16:36:23 +0200
committerLukas Rytz <lukas.rytz@typesafe.com>2016-05-23 16:36:23 +0200
commitf640fa0a6d01270b4c16238073c154bf0e71b559 (patch)
tree7bc58ad05effbdfa7653fea52cf12e8780fb6d7e /src
parent41965695b71bc00ea60003c39c72a0e10bfd621f (diff)
parentc89c36597f922fe29cbb3cec8095611f86ba4976 (diff)
downloadscala-f640fa0a6d01270b4c16238073c154bf0e71b559.tar.gz
scala-f640fa0a6d01270b4c16238073c154bf0e71b559.tar.bz2
scala-f640fa0a6d01270b4c16238073c154bf0e71b559.zip
Merge pull request #5167 from martijnhoekstra/SI-9766
SI 9766 - allow ++ on empty ConcatIterator
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/collection/Iterator.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala
index 8d88b1c6b1..9ba16976bd 100644
--- a/src/library/scala/collection/Iterator.scala
+++ b/src/library/scala/collection/Iterator.scala
@@ -200,7 +200,8 @@ object Iterator {
} else Iterator.empty.next()
override def ++[B >: A](that: => GenTraversableOnce[B]): Iterator[B] =
- new ConcatIterator(current, queue :+ (() => that.toIterator))
+ if(current eq null) new JoinIterator(Iterator.empty, that)
+ else new ConcatIterator(current, queue :+ (() => that.toIterator))
}
private[scala] final class JoinIterator[+A](lhs: Iterator[A], that: => GenTraversableOnce[A]) extends Iterator[A] {