diff options
Diffstat (limited to 'src/library/scala/Range.scala')
-rw-r--r-- | src/library/scala/Range.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/library/scala/Range.scala b/src/library/scala/Range.scala index 8a6ba86bff..dbd4f82f69 100644 --- a/src/library/scala/Range.scala +++ b/src/library/scala/Range.scala @@ -170,7 +170,7 @@ extends VectorView[Int, Vector[Int]] with RangeToString[Int] */ def by(step: Int): Range = new Range(start, end, step) - override def foreach[U](f: Int => U) { + final override def foreach[U](f: Int => U) { var i = start if (step > 0) { while (i < end) { @@ -192,7 +192,8 @@ extends VectorView[Int, Vector[Int]] with RangeToString[Int] else plen(end, start, -step) } - def apply(idx: Int): Int = { + @inline + final def apply(idx: Int): Int = { if (idx < 0 || idx >= length) throw new IndexOutOfBoundsException(idx.toString) start + idx * step } @@ -206,7 +207,7 @@ extends VectorView[Int, Vector[Int]] with RangeToString[Int] object Range { /** @deprecated use Range.inclusive instead */ - class Inclusive(start: Int, end0: Int, step: Int) + final class Inclusive(start: Int, end0: Int, step: Int) extends Range(start, if (step > 0) end0 + 1 else end0 - 1, step) { self => override def by(step: Int): Range = new Inclusive(start, end0, step) } |