Scala class and case class == comparison

Solution 1:

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.