diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2009-05-12 12:12:10 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2009-05-12 12:12:10 +0000 |
commit | 11f5744d1f3370d5519e80f4814e273c5d82b5c1 (patch) | |
tree | 705c61ddb0ca13ab27acdb7d3b9a133453c0f37e | |
parent | ca3d31e7b25e4709839671f2ee5c5bd643cbc08e (diff) | |
download | scala-11f5744d1f3370d5519e80f4814e273c5d82b5c1.tar.gz scala-11f5744d1f3370d5519e80f4814e273c5d82b5c1.tar.bz2 scala-11f5744d1f3370d5519e80f4814e273c5d82b5c1.zip |
Patch for #1970 (submitted by jeortiz).
-rw-r--r-- | src/library/scala/collection/generic/IterableTemplate.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/library/scala/collection/generic/IterableTemplate.scala b/src/library/scala/collection/generic/IterableTemplate.scala index 40f66e2d38..8e05b95c29 100644 --- a/src/library/scala/collection/generic/IterableTemplate.scala +++ b/src/library/scala/collection/generic/IterableTemplate.scala @@ -136,8 +136,11 @@ trait IterableTemplate[+A, +This <: IterableTemplate[A, This] with Iterable[A]] def sameElements[B >: A](that: Iterable[B]): Boolean = { val these = this.elements val those = that.elements - while (these.hasNext && those.hasNext && these.next() == those.next()) {} - !these.hasNext && !those.hasNext + var res = true + while (res && these.hasNext && those.hasNext) { + res = (these.next == those.next) + } + !these.hasNext && !those.hasNext && res } /** Returns a stream with all elements in this traversable object. |