This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 4.15, “How to define an
equals method (object equality) in Scala.”
You want to define an equals method for a Scala class so you can compare object instances to each other.
There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.