I have some misunderstanding in what cases I should use case class or regular class following by best practices. I have already read about differences of both classes but ca
A case class gives you "free" (i.e., you don't have to write) implementations of equals
, hashcode
and toString
, as well as apply
and unapply
in the companion object.
Basically, you can think of a case class as a named tuple, whose fields are named as well.
For anything else, you're probably better off using a normal class.