|
Scala 2
|
class
Enumeration
extends
java.lang.Object with
ScalaObjectThe class Enumeration
provides the same functionality as the
enum
construct found in C-like languages like C++ or Java.
Here is an example:
object Main with Application { object WeekDays extends Enumeration { val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value } def isWorkingDay(d: WeekDays.Value) = ! (d == WeekDays.Sat || d == WeekDays.Sun); WeekDays filter (isWorkingDay) foreach { d => System.out.println(d) } }
Constructor Summary | |
def
this
|
|
def
this
( initial : scala.Int , names : scala.<repeated> )
|
|
def
this
( names : scala.<repeated> )
|
Class Summary | |
protected
|
class
Val
|
abstract
|
class
Value
|
Def Summary | |
final protected
|
def
Value
( i : scala.Int )
: Value
|
final protected
|
def
Value
( i : scala.Int , name : java.lang.String )
: Value
|
final protected
|
def
Value
( name : java.lang.String )
: Value
|
final protected
|
def
Value
: Value
|
final
|
def
apply
( x : scala.Int )
: Value
Returns the enumeration value for the given id. |
final
|
def
elements
: Iterator
Returns all values of this enumeration. |
def
exists
( p : Function1 )
: scala.Boolean
|
|
def
filter
( p : Function1 )
: Iterator
|
|
def
flatMap
[ b ]
( f : Function1 )
: Iterator
|
|
def
forall
( p : Function1 )
: scala.Boolean
|
|
def
foreach
( f : Function1 )
: scala.Unit
|
|
def
map
[ b ]
( f : Function1 )
: Iterator
|
|
final
|
def
maxId
: scala.Int
|
def
name
: java.lang.String
|
|
override
|
def
toString
: java.lang.String
|
Constructor Detail |
def
this
def
this
( initial : scala.Int , names : scala.<repeated> )
def
this
( names : scala.<repeated> )
Def Detail |
def
Value
( i : scala.Int ) : Value
def
Value
( i : scala.Int , name : java.lang.String ) : Value
def
Value
( name : java.lang.String ) : Value
def
Value
: Value
def
apply
( x : scala.Int ) : Value
def
elements
: Iterator
def
exists
( p : Function1 ) : scala.Boolean
def
filter
( p : Function1 ) : Iterator
def
flatMap
[ b ]( f : Function1 ) : Iterator
def
forall
( p : Function1 ) : scala.Boolean
def
foreach
( f : Function1 ) : scala.Unit
def
map
[ b ]( f : Function1 ) : Iterator
def
maxId
: scala.Int
def
name
: java.lang.String
def
toString
: java.lang.String