score:65

Accepted answer

A case class implements the equals method for you while a class does not. Hence, when you compare two objects implemented as a class, instead of case class, what you're comparing is the memory address of the objects.

It's really the same issues as when you have to deal with equality in Java. See this Artima blog post about writing equals in Java (and Scala) written by Bill Venners, Martin Odersky, and Lex Spoon.


Related Query

More Query from same tag