Scala Library Documentation
|
|
scala/Symbol.scala
]
case final
class
Symbol(val
name : java.lang.String)
extends
Product
This class provides a simple way to get unique objects for
equal strings. By default, symbols use string equality for
equality testing, but interned symbols can be compared using
reference equality for the same effect. Instances of
Symbol
can be created easily with Scala's built-in
quote mechanism.
For instance, the Scala
term 'mysym
will invoke the constructor of the
Symbol
class in the following way:
new Symbol("mysym").intern
.
Method Summary | |
override def
|
equals (arg0 : Any) : Boolean |
override def
|
hashCode : Int |
def
|
intern : Symbol |
override final def
|
productArity
: Int
return k for a product
A(x_1,...,x_k)) |
override final def
|
productElement
(arg0 : Int) : Any
for a case class
A(x_1,...,x_k)) , returns x_(i+1)
for 0 <= i < k |
override final def
|
productPrefix
: java.lang.String
By default the empty string. Implementations may override this
method in order to prepend a string prefix to the result of the
toString methods.
|
override def
|
toString
: java.lang.String
Converts this symbol to a string.
|
Methods inherited from AnyRef | |
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Method Details |
override
def
toString : java.lang.String
def
intern : Symbol
Makes this symbol into a unique reference.
If two interened symbols are equal (i.e. they have the same name) then they must be identical (wrt reference equality).
override
def
hashCode : Int
override final
def
productPrefix : java.lang.String
override final
def
productArity : Int
A(x_1,...,x_k))
A(x_1,...,x_k))
, returns x_(i+1)
for 0 <= i < k
n -
the position of the n-th elementIndexOutOfBoundsException -
Scala Library Documentation
|
|