Confusing AnyRef equals

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Confusing AnyRef equals

Georgii Dernovyi
I found that subj returns false for the same object. It is a terrible mistake for me

case class a(i:Int)
{
override def canEqual(a: Any) = a.isInstanceOf[a]

override def equals(o:Any) = AnyRef.equals(o)

override def hashCode = AnyRef.hashCode
}

val aa = new a(1)
aa == aa //false

Am I right? )

--
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Confusing AnyRef equals

rizieq
This post has NOT been accepted by the mailing list yet.
semoga ada master dari code html yang bersedia memecahkan masalah anda
Kunjungi Alatkesehatan.id untuk mendapatkan informasi harga jual nebulizer omron yang terbaru di Indonesia
Loading...