Core concept

val m = Map("a" -> 1, "b" -> 2)
m("a")  // 1
m + ("c" -> 3)  // new Map
Advertisement

How it works

Update = new Map. Persistent structure sharing.

Advertisement

Trade-offs + gotchas

Immutable lookup + update.