Brian Enochson
Jan 20, 2024

--

Hey, thanks for the question. If you mean reassigning fields as assigning new values this breaks what Java records are built for. They are meant to be completely immutable objects that do not allow modification once created. If there is a new value for a field, this would be a new record. Hope I understood. And yes, you could implement a copy or using builder to easily (and safely ) create that new record.

--

--

Brian Enochson
Brian Enochson

Written by Brian Enochson

Developer… you know. Interested in everything technology related. Follow me as I will keep producing content!!

No responses yet