3 ms·
Record are product types, with union types (sealed types in Java speak) you get algebraic data type, you can take a look to SML to understand why there will be
by _old_dude_ 7y ago
Record are product types, with union types (sealed types in Java speak) you get algebraic data type, you can take a look to SML to understand why there will be used a lot.
Record have an automatic way to propagate annotations from the record component to the generated methods/fields and comes with native support of serialization (like enums).
- llcoolv 7y agoCould you show an example of it? In none of the materials published so far there is anything even remotely similar to what you are suggesting.
- krzyk 7y agohttp://cr.openjdk.java.net/~briangoetz/amber/datum.html http://cr.openjdk.java.net/~briangoetz/amber/datum.html There you can read about algebraic data types in java, in Java 14 you get preview for records in Java 15 probably you'll get preview for sealed types - they were developed together for some time, only recently there was a split.