The Record: Migrate to Immutability
summary
Records replace POJOs with a one-line immutable carrier that gives a canonical constructor, getters (no get prefix), toString/hashCode/equals for free, and can speed tight loops only at millions of ops/sec; they are only shallowly immutable so a Box with an ArrayList still allows mutation unless you use defensive copies like List.copyOf (which works). Migration tools include IntelliJ Lombok→record recipe and builders or the planned JEP-468 withers (not yet released), and converting often reveals latent bugs via failing tests.
AI-written summary · about
chapters (8)
- 0:00Intro
- 0:37The Record
- 2:15When to use records
- 4:47How to get mutable records
- 7:19Defensive constructors
- 8:36Width functions
- 10:18When to stop migrating
- 11:50Should you migrate
related talks
50mBetter Tools for Immutable Data
42mBetter Modeling Through Records
46mJava Records for the Intrigued
31mData Oriented Programming and Matching in Java
15mWorld Records - Overview and Use Cases for Records
34mWhen Records Meet Serialization A Happy Tale
37mRecords, Not Just Constant Classes, A Deep Dive
15mWorld Record — Overview and Use Cases for Records
