Browse Clojure Foundations for Java Developers

Collections

Vectors, maps, sets, lists, and sequences—Clojure’s core data structures.

Clojure’s core data structures are immutable persistent collections. That phrase is worth learning early:

  • Immutable: operations don’t modify a collection in place.
  • Persistent: “updates” return a new collection while sharing structure with the old one (so it’s usually fast enough for real systems).

Java mental model: instead of “mutate an ArrayList”, you usually “produce a new value” and pass it forward—making tests, concurrency, and reasoning simpler.

The big four (+ one abstraction)

  • Vector []: your default “ordered collection” (think: immutable, value-oriented cousin of ArrayList).
  • Map {}: key/value data (think: immutable HashMap that you build up via assoc, update, dissoc).
  • Set #{}: membership and uniqueness.
  • List (): shows up a lot as code (forms) and in some sequence processing; less common as an everyday data container.
  • Seq: an abstraction over “things you can iterate”. Most of Clojure’s collection functions (map, filter, reduce, …) speak in seqs.

A few practical gotchas (worth memorizing)

  • conj adds to the end of a vector, but the front of a list.
  • Many functions return lazy sequences, which is great for composition but changes when work happens.

The goal of this section is to make you fluent at reading collection literals, predicting what common operations return, and choosing the default collection that keeps your code simple.

In this section

Revised on Friday, April 24, 2026