diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-02-17 20:03:07 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-02-17 20:03:07 +0000 |
commit | 0171fdede17e5340cc034c742a11e9f2a03c6042 (patch) | |
tree | 5ad113b9eee6669878854002d5e04e9c4817125a /src/library | |
parent | 0ee11c38762844fa78bf2fd0861680c4b6ac2e8e (diff) | |
download | scala-0171fdede17e5340cc034c742a11e9f2a03c6042.tar.gz scala-0171fdede17e5340cc034c742a11e9f2a03c6042.tar.bz2 scala-0171fdede17e5340cc034c742a11e9f2a03c6042.zip |
fix for #1721
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/Seq.scala | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/library/scala/Seq.scala b/src/library/scala/Seq.scala index 0d1306b07f..18b8dac676 100644 --- a/src/library/scala/Seq.scala +++ b/src/library/scala/Seq.scala @@ -470,15 +470,8 @@ trait Seq[+A] extends AnyRef with PartialFunction[Int, A] with Collection[A] { /** @return true if this sequence end with that sequence * @see String.endsWith */ - def endsWith[B](that: Seq[B]): Boolean = { - val length = this.length - val j = that.elements - var i = 0 - var result = true - while (result && i < length && j.hasNext) - result = apply(length - i - 1) == j.next - result && !j.hasNext - } + def endsWith[B](that: Seq[B]): Boolean = + drop(length - that.length).sameElements(that) /** * Searches for the argument sequence in the receiver object, returning |