In Scala, an extractor defines a method unapply(), as well as an optional method, apply(). For mapping and unmapping data between form and model data, both apply and unapply methods are used.
Apply() method: Assembling an object from its components is done with this method. For example, by using the two components firstName and lastName, we can create the Employee object with the apply method.
Unapply() method: This method follows the reverse order of apply order and decomposes an object into components. For example, you can break or decompose that employee object down into its components i.e., firstName and lastName.