The aggregate and exploded forms of data classes

The aggregate form of a data class will be the name of the data class. Its exploded form would refer to the variables used to store its data. The conversion from aggregate to exploded form is referred to as the deconstruction pattern.

The following code refers to the example that we used in the preceding section:

record Emp(String name, int age) { }       

Emp is the aggregate form of the Emp data class. Its exploded form would be String name and int age. The language would need easy conversion between the two, so that they can be used with other language constructs, such as switch.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.72.15