Skip to main content

6 docs tagged with "immutability"

View all tags

Encapsulation

Hide internal state behind a controlled interface — access modifiers, getters/setters, and the art of designing immutable classes.

Immutable Collections

How to create truly immutable List, Set, and Map instances in Java using the Java 9+ factory methods and how they differ from the older Collections.unmodifiable wrappers.

Records (Java 16+)

Java's concise immutable data carrier — understand what records generate automatically, compact constructors, and when records replace traditional value classes.

Strings

String immutability, the string pool, StringBuilder, and the most useful String APIs in Java.

Thread Safety Patterns

Three design-level strategies for writing correct concurrent code — immutability, ThreadLocal confinement, and explicit object confinement — without reaching for locks.