What do you mean by a case class in scala?

devquora
devquora

Posted On: Feb 22, 2018

 

These classes in scala are the classes which are declared by using a special modifier case. The constructor parameters are exported using these case classes which hence provide a recursive decomposition mechanism through pattern matching. We treat the constructor parameters of the case classes as public values and so they can be accessed directly. The companion objects and its related methods can also be generated automatically for the case classes. All the methods in the class and the companion objects are generated based on the parameter list. It helps in automatically generating the methods from the parameter list. By default, case objects and classes are serializable.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Scala interview questions

    What do you mean by a Scala map?

    The collection of key-value pairs where the key can retrieve the values present in a map is known as a scala map. The k..

    Scala interview questions

    List the advantages of using scala over other functional programming languages.

    Some of the advantages due to which scala is preferred over other functional programming languages are listed below: As..

    Scala interview questions

    Tell the advantages of companion objects when used in Scala?

    Instead of having static methods or variables, scala has singleton or companion objects. These objects are then compile..