diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-05-27 15:40:16 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-05-27 15:40:16 +0200 |
commit | 5551cf66e5b27ae398b527df6fe4247aed1ff307 (patch) | |
tree | 34cc550412c44edef803297db35d34dde21fdde9 /src/library | |
parent | b20bb5587fbd36b212027a04a62f65d6709d05af (diff) | |
parent | 71cfb57499bda80f5fb0a810f37d0f9c54e1afd3 (diff) | |
download | scala-5551cf66e5b27ae398b527df6fe4247aed1ff307.tar.gz scala-5551cf66e5b27ae398b527df6fe4247aed1ff307.tar.bz2 scala-5551cf66e5b27ae398b527df6fe4247aed1ff307.zip |
Merge pull request #3733 from retronym/topic/pr-3712-resubmit
SI-8475 Fix off by one in GroupedIterator when Streaming
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/Iterator.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala index 1b496383a3..e321a6adba 100644 --- a/src/library/scala/collection/Iterator.scala +++ b/src/library/scala/collection/Iterator.scala @@ -926,7 +926,9 @@ trait Iterator[+A] extends TraversableOnce[A] { private def takeDestructively(size: Int): Seq[A] = { val buf = new ArrayBuffer[A] var i = 0 - while (self.hasNext && i < size) { + // The order of terms in the following condition is important + // here as self.hasNext could be blocking + while (i < size && self.hasNext) { buf += self.next i += 1 } |