diff options
author | Scott R. Parish <srp@srparish.net> | 2012-05-15 08:59:43 -0500 |
---|---|---|
committer | Scott R. Parish <srp@srparish.net> | 2012-05-15 08:59:47 -0500 |
commit | 0570a9357b7a73842220ff6b465cb7cbd3ae7ea8 (patch) | |
tree | ea5603b8c5f765822dba500beefc54acf91c9786 /src/library | |
parent | 8a90ca702754b776ae7de120691974332ed77618 (diff) | |
download | scala-0570a9357b7a73842220ff6b465cb7cbd3ae7ea8.tar.gz scala-0570a9357b7a73842220ff6b465cb7cbd3ae7ea8.tar.bz2 scala-0570a9357b7a73842220ff6b465cb7cbd3ae7ea8.zip |
Enumeration#maxId: fix documentation to reflect reality
maxId is not really the "maximum id", but rather one past the max:
scala> object Foo extends Enumeration {
| val x = Value
| val y = Value
| }
defined module Foo
scala> Foo.maxId
res0: Int = 2
scala> Foo(2)
java.util.NoSuchElementException: key not found: 2
at scala.collection.MapLike$class.default(MapLike.scala:225)
...
scala> Foo(1)
res2: Foo.Value = y
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/Enumeration.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala index ea0d20957d..2b658ee4f7 100644 --- a/src/library/scala/Enumeration.scala +++ b/src/library/scala/Enumeration.scala @@ -113,8 +113,8 @@ abstract class Enumeration (initial: Int) extends Serializable { * enumeration, but no higher than 0. */ private var bottomId = if(initial < 0) initial else 0 - /** The highest integer amongst those used to identify values in this - * enumeration. */ + /** The one higher than the highest integer amongst those used to identify + * values in this enumeration. */ final def maxId = topId /** The value of this enumeration with given id `x` |