diff options
author | Paul Phillips <paulp@improving.org> | 2010-01-20 00:28:09 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-01-20 00:28:09 +0000 |
commit | 10ee5fd9cef30afa576808cbead4dc57952c13f4 (patch) | |
tree | 40a1f9718fae039d793fb2ec15bf3dd91377888b /src/library/scala/collection/LinearSeqLike.scala | |
parent | 08013877acb1155fa46398988efaa2cab21f78ae (diff) | |
download | scala-10ee5fd9cef30afa576808cbead4dc57952c13f4.tar.gz scala-10ee5fd9cef30afa576808cbead4dc57952c13f4.tar.bz2 scala-10ee5fd9cef30afa576808cbead4dc57952c13f4.zip |
Fix for #2927. No review.
Diffstat (limited to 'src/library/scala/collection/LinearSeqLike.scala')
-rw-r--r-- | src/library/scala/collection/LinearSeqLike.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/library/scala/collection/LinearSeqLike.scala b/src/library/scala/collection/LinearSeqLike.scala index 9bed88967c..665b760932 100644 --- a/src/library/scala/collection/LinearSeqLike.scala +++ b/src/library/scala/collection/LinearSeqLike.scala @@ -305,11 +305,14 @@ trait LinearSeqLike[+A, +Repr <: LinearSeqLike[A, Repr]] extends SeqLike[A, Repr def indexWhere(p: A => Boolean, from: Int): Int = { var i = from var these = this drop from - while (!these.isEmpty && !p(these.head)) { + while (these.nonEmpty) { + if (p(these.head)) + return i + i += 1 these = these.tail } - if (these.isEmpty) -1 else i + -1 } override /*SeqLike*/ |