Browse Clojure Foundations for Java Developers

Immutability in Clojure

Persistent immutable collections, structural sharing, and why this is practical on the JVM.

In Clojure, immutability is not “a best practice”. It is the default. When you “change” a vector or map, you get a new value back, and the old one is still valid.

The key idea that makes this practical is structural sharing: the new collection reuses most of the old collection’s structure instead of copying everything.

What to internalize early

  • Use assoc, update, conj, dissoc to produce new values.
  • Do not look for setters. Data is just data.
  • Keep mutation at the edges (interop, I/O, state coordination).

Java mental model: final references and unmodifiable collections are optional in Java. In Clojure, “no in-place mutation” is built into the standard data structures.

Once you trust immutability, many other Clojure idioms become obvious: concurrency is safer, tests are simpler, and refactors have fewer hidden coupling points.

In this section

Revised on Friday, April 24, 2026