Zum Inhalt springen

Immutable Objects Using Record in Java

It is often useful to have objects that, once created, don’t change their content. To see a complete description on how to build such class, you can read my previous article „Immutable Objects in Java„.

Let’s imagine we want to build a PersonClass with two fields: firstName and lastName. To create immutable instances, this class must:

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert