4 ms·
This kind of thing happens often enough that it really should be baked into the language. Since Java 17 there are records.
by ithrow 4y ago
This kind of thing happens often enough that it really should be baked into the language.
Since Java 17 there are records.
- sandGorgon 4y agothis too. Records are basically classes with everything public right ?
- kaba0 4y agoRecords are classes with a canonical constructor that lists every field it has. The fields themselves are not public, but a method with the same name is automatically generated for each (basically a getter, just not getName(), but name() as the former is not consistent (what should be the getter for field Xx?). This result in records being shallowly immutable.