Wednesday, 22 May 2013

Scala Equality in 30 seconds


  1. In scala == delegages to equals method.

  2.  a == b is equivalent to a equals b
  3. If you want to check referrential equality you call eq method. 

  4.  a eq b is true only if a and b are referrences to the same object
  5. Case classes and Value Classes (2.10) get the equals and hashcode based on class parameters for free.


End of the story!

No comments:

Post a Comment