Section outline

    • Micro-topic BB2_L22_M1 — Immutability: the cheat code for correctness

      Goal: You can explain immutability clearly and use it to prevent bugs in collections, streams, and real apps.

    • Micro-topic BB2_L22_M2 — final for real: variables, fields, methods, classes, and “effectively final”

      Goal: You know exactly what final guarantees (and what it does not), and you use it as a defensive tool.

    • Micro-topic BB2_L22_M3 — Unmodifiable vs immutable: views, snapshots, and what actually protects you

      Goal: You stop confusing “unmodifiable wrapper” with “immutable data,” and you choose the right defensive tool.

    • Micro-topic BB2_L22_M4 — Defensive copying: constructors, getters, and avoiding “leaked state”

      Goal: You can design classes that cannot be broken by callers who pass mutable objects or keep references.

    • Micro-topic BB2_L22_M5 — Defensive coding playbook: fail fast, validate, and design APIs that resist misuse

      Goal: You can write code that stays correct even when users (or future-you) do dumb things.