How do you test reference equality in Scala?
val x = new Obj
val y = x
x.referenceEquals(y) // evaluates to true
How do you test reference equality in Scala?
val x = new Obj
val y = x
x.referenceEquals(y) // evaluates to true
The function you are looking for is eq
, which is a member of AnyRef:
val x = new Obj
val y = x
x eq y // evaluates to true
x ne y // evaluates to false