summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-09-26 14:29:12 -0700
committerSom Snytt <som.snytt@gmail.com>2016-09-26 14:29:12 -0700
commitae0269200c6e5af8120587e2317f595e746c6114 (patch)
tree0338816b25d52661777c8936ccc6f154f8fae474 /src/library
parent63f5eb5eb751fa5bfb69d0e783aa360abac82a1b (diff)
downloadscala-ae0269200c6e5af8120587e2317f595e746c6114.tar.gz
scala-ae0269200c6e5af8120587e2317f595e746c6114.tar.bz2
scala-ae0269200c6e5af8120587e2317f595e746c6114.zip
SI-9936 SeqLike.indexWhere starts at zero
This follows the Scaladoc, and makes ``` "abcdef".indexOf('c', -1) ``` work like ``` "abcdef".toVector.indexOf('c', -1) ```
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/collection/SeqLike.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/library/scala/collection/SeqLike.scala b/src/library/scala/collection/SeqLike.scala
index a26765027c..2d662257e5 100644
--- a/src/library/scala/collection/SeqLike.scala
+++ b/src/library/scala/collection/SeqLike.scala
@@ -113,7 +113,7 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[
}
def indexWhere(p: A => Boolean, from: Int): Int = {
- var i = from
+ var i = from max 0
val it = iterator.drop(from)
while (it.hasNext) {
if (p(it.next())) return i