Case class-an Ultra POJO class in Scala
POJO stands for Plain-Old Java Object, a class that will have set of fields and their getters and setters. Pojo class is primarily used as a data structure or data carrier across the layers in the J2EE applications. It is understood as more of a best practice than a language standard to define one using any special keyword like pojo. Is there any equivalent of such class in Scala? yes there is. But not just for a data structure but with valiant features to cater in various usage. Case comes with handy Case class in Scala is used for the purpose of defining an object with immutable data. On the otherhand, when a class is defined as a Case class, a lot of boilerplate code is generated by the Scala compiler. The methods like apply, unapply, tupled, copy, set of accessors and mutators, and objects default methods like toString, hashCode, and equals are part of the generated boilerplate code. A question might pop-up in our mind, Isn’t a case class similar to j...