Java Records

Опубликовано: 14 Май 2020
на канале: Jakob Jenkov
16,399
537

A Java Record is a special type of Java class specifically designed to represent a data record, like records returned from a database or remote service. Java Records offer a more concise syntax than defining POJOs the old school way. Java Records is a new feature in Java 14.
Java Records is still a preview features, so we don't know yet if records will stay in Java. In order to use Java Records you must thus switch preview feature on in your Java SDK / IDE.

Java Records are immutable, by the way, so once created you cannot change the values stored in the record instance.

Chapters
0:00 Java Record introduction
1:46 Java Record example
2:30 What the Java compiler auto-generates for you in a Java Record
5:13 Extra constructors in a Java Record
6:31 Instance methods in a Java Record
7:35 Static methods in a Java Record

Java Record Tutorial - textual version:
http://tutorials.jenkov.com/java/reco...