AnyRef
Class AnyRef
is the root class of all reference types.
All types except the value types descend from this class.
Value members
Concrete methods
Tests whether the argument (that
) is a reference to the receiver object (this
).
Tests whether the argument (that
) is a reference to the receiver object (this
).
The eq
method implements an equivalence relation on
non-null instances of AnyRef
, and has three additional properties:
It is consistent: for any non-null instances
x
andy
of typeAnyRef
, multiple invocations ofx.eq(y)
consistently returnstrue
or consistently returnsfalse
.For any non-null instance
x
of typeAnyRef
,x.eq(null)
andnull.eq(x)
returnsfalse
.null.eq(null)
returnstrue
.
When overriding the equals
or hashCode
methods, it is important to ensure that their behavior is
consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2
), they
should be equal to each other (o1 == o2
) and they should hash to the same value (o1.hashCode == o2.hashCode
).
- Value parameters:
- that
the object to compare against this object for reference equality.
- Returns:
true
if the argument is a reference to the receiver object;false
otherwise.
Equivalent to !(this eq that)
.
Equivalent to !(this eq that)
.
- Value parameters:
- that
the object to compare against this object for reference equality.
- Returns:
true
if the argument is not a reference to the receiver object;false
otherwise.
Wakes up a single thread that is waiting on the receiver object's monitor.
Wakes up a single thread that is waiting on the receiver object's monitor.
- Note:
not specified by SLS as a member of AnyRef
Wakes up all threads that are waiting on the receiver object's monitor.
Wakes up all threads that are waiting on the receiver object's monitor.
- Note:
not specified by SLS as a member of AnyRef
Executes the code in body
with an exclusive lock on this
.
Executes the code in body
with an exclusive lock on this
.
- Value parameters:
- body
the code to execute
- Returns:
the result of
body
- Value parameters:
- timeout
the maximum time to wait in milliseconds.
- Note:
not specified by SLS as a member of AnyRef