Java Immutability

Immutable objects in modern Java: records in depth, defensive copies, immutable collection factories versus unmodifiable views, deep versus shallow immutability, final-field semantics and safe publication (JMM), and the withers pattern. Use when designing a value object, when a record has a List, Map or array component, when an accessor returns internal mutable state, when an "immutable" object is observed changing, or when deciding whether immutability is worth its allocation cost. Does not cover null validation in constructors (java-null-safety) or Optional usage (java-optional).

robsonkades Updated 3 repo stars

File contents

robsonkades/agent-skills commit a9ddf2892d

Frequently asked questions

npx get-skill add robsonkades/java-immutability