Category: Other Aspects of Record Classes
-
Enum Values in Exhaustive switch Expressions – Object-Oriented Programming
Enum Values in Exhaustive switch Expressions A switch expression is always exhaustive—that is, the cases defined in the switch expression must cover all values of the selector expression type or the code will not compile (§4.2, p. 160). The switch expression below at (1) is exhaustive, as all values of the enum type Day are…
-
Record Classes – Object-Oriented Programming
5.14 Record Classes Exchanging plain data between programs is a common task. Plain data objects allow efficient aggregation of data and provide transparent access to it. In the literature, such data objects are referred to by different names; the acronym POJOs (Plain Old Java Objects) is common in the Java community. A plain data class…