diff options
author | Heejong Lee <heejong@gmail.com> | 2013-04-30 14:59:52 +0900 |
---|---|---|
committer | Heejong Lee <heejong@gmail.com> | 2013-04-30 14:59:52 +0900 |
commit | 357c2df4766a35089d91f92067b0cb87924f0ec9 (patch) | |
tree | c2986dd735eed4614e48ae493000abf3e56436da /src/library | |
parent | 1f2772a2375a02937d71b33ac5a6a9cc6eb2fdb5 (diff) | |
download | scala-357c2df4766a35089d91f92067b0cb87924f0ec9.tar.gz scala-357c2df4766a35089d91f92067b0cb87924f0ec9.tar.bz2 scala-357c2df4766a35089d91f92067b0cb87924f0ec9.zip |
SI-7432 Range.min should throw NoSuchElementException on empty range
For consistency, range.max and range.min should throw
NoSuchElementException on an empty range.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/immutable/Range.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala index 243e3fcb91..eb11c61136 100644 --- a/src/library/scala/collection/immutable/Range.scala +++ b/src/library/scala/collection/immutable/Range.scala @@ -81,14 +81,14 @@ extends scala.collection.AbstractSeq[Int] override def min[A1 >: Int](implicit ord: Ordering[A1]): Int = if (ord eq Ordering.Int) { - if (step > 0) start + if (step > 0) head else last } else super.min(ord) override def max[A1 >: Int](implicit ord: Ordering[A1]): Int = if (ord eq Ordering.Int) { if (step > 0) last - else start + else head } else super.max(ord) protected def copy(start: Int, end: Int, step: Int): Range = new Range(start, end, step) |