Immutability in Java 21: Records, Defensive Copying, and Collections

If you’ve been writing Java for a while, you probably think you know how to write immutable classes.