Immutable collection
An immutable collection is a collection whose membership and contents cannot be changed after creation.
Data-Oriented Programming: Reduce software complexity
Immutable data is data whose stored value cannot be modified after creation, requiring changes to be represented by new data versions.
- How it is used
- Uses immutable collections to communicate between components, manage versions of state, and simplify generic data flows.
- How deep it goes
- Explains freezing, persistent data structures, structural sharing, versioned state, and library APIs; defers detailed concurrency control to later treatment.
- Examples
- Demonstrates Java immutable lists and maps, JavaScript freezing, Lodash FP updates, Immutable.js maps, and library-state versions.
- What you can do after
- Apply it via Java, JavaScript, Lodash FP, or Immutable.js to preserve collections and create changed versions.
Read how Data-Oriented Programming: Reduce software complexity explains immutable collection →
The Joy of JavaScript
An object whose fields cannot be changed after creation and whose state is represented without in-place mutation.
- How it is used
- Keeps existing array and value-object state intact while functional transformations produce results.
- How deep it goes
- Shows array-operation contrasts and a frozen Money implementation, while treating immutable design as a choice rather than requiring it for every object.
- Examples
- Uses block validation with filter, map, and reduce, plus a frozen Money object whose arithmetic returns new values.
- What you can do after
- Build it from scratch as a frozen Money-style value object, or apply array transformations without changing the original array.
Read how The Joy of JavaScript explains immutable collection →
Functional Programming in JavaScript
The property of data or state not changing after it has been created.
- How it is used
- Frames functional programming as a way to minimize moving parts and shared state.
- How deep it goes
- Introduces immutability through stateful counter and array-transformation contrasts, deferring deeper treatment.
- Examples
- Contrasts an external counter mutation and an array-squaring loop with functional expressions using `map`.
- What you can do after
- Evaluate/understand when external state changes make computations unpredictable and when input-to-output expressions avoid that dependency.
Read how Functional Programming in JavaScript explains immutable collection →
Idiomatic Rust
Immutability is the property that existing values or data structures cannot be modified after they are created.
- How it is used
- Uses immutable collections to preserve earlier values while making data changes easier to reason about.
- How deep it goes
- Works through Cow-based construction and im Vector cloning, but leaves full crate details to their documentation.
- Examples
- Demonstrates a Cow-backed list whose method returns a new version and an im Vector updated after cloning.
- What you can do after
- Build it from scratch with Cow, or apply it via im while retaining earlier collection versions.
Fabulous Adventures in Data Structures and Algorithms
An immutable data structure is a data structure whose contents cannot be changed after it is created.
- How it is used
- Preserves earlier collection states for undo-redo and supports branching work such as backtracking search.
- How deep it goes
- Builds stacks from linked lists, develops collection interfaces, and analyzes performance; recommends standard-library collections for production.
- Examples
- Branches an immutable stack into shared-tail versions and reverses a linked list without changing the original.
- What you can do after
- Build it from scratch as a basic immutable stack and judge when shared state makes immutable versions efficient.
Read how Fabulous Adventures in Data Structures and Algorithms explains immutable collection →
Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform
Immutability is a paradigm in which an established artifact is not modified in place and changes are made by creating a new version.
- How it is used
- Uses infrastructure as code to replace resources safely, reduce drift, support controlled deployments, and recover from failures.
- How deep it goes
- Explains definitions, migration ordering, blue-green deployment, and roll-forward recovery without descending into provider-specific internals.
- Examples
- Uses Python server upgrades, machine images, brownfield network migration, green networks, and service-account permission repair.
- What you can do after
- Operate immutable IaC by replacing resources, migrating brownfield infrastructure, testing dependent changes, and rolling forward repairs.
100 Java Mistakes and How to Avoid Them
An immutable collection is a collection whose state cannot be changed after construction.
- How it is used
- Prevents runtime failures when code attempts to mutate Java collections whose modification operations are unsupported.
- How deep it goes
- Explains mutation restrictions, inconsistent API behavior, null-related migration risks, and limits of static analysis rather than collection internals.
- Examples
- Uses Arrays.asList, Map.keySet, List.of, a conditional sanitize result, List.copyOf, and Set.of null lookups.
- What you can do after
- Diagnose/debug with it by identifying unsafe mutation calls and choosing consistently mutable or unmodifiable return values.
Read how 100 Java Mistakes and How to Avoid Them explains immutable collection →
Grokking Simplicity
Data or state whose represented values cannot be modified after creation.
- How it is used
- Uses immutable data to turn data reading and transformation into calculations while isolating actions and mutable state.
- How deep it goes
- Implements copy-on-write for JavaScript arrays and objects, extends it to nested data and untrusted code, and addresses performance tradeoffs.
- Examples
- Demonstrates pizza-business data, shopping carts, JavaScript array copying, nested structures, and ValueCells.
- What you can do after
- Build it from scratch with copy-on-write array and object operations, or apply defensive copying when code cannot be trusted.
Read how Grokking Simplicity explains immutable collection →
Python Workout: 50 ten-minute exercises
A property of an object whose state cannot be changed after the object is created.
- How it is used
- Explains why Python programs replace immutable values instead of modifying them in place.
- How deep it goes
- Defines immutability, demonstrates failed string mutation, and connects it to functions, threads, dictionaries, and functional programming.
- Examples
- Uses indexed string assignment, rebinding, list-versus-tuple comparisons, and immutable data transformations.
- What you can do after
- Apply immutable-value reasoning when choosing collections, passing data to functions, and replacing rather than modifying values.
Read how Python Workout: 50 ten-minute exercises explains immutable collection →
Tiny Python Projects: Learn coding and testing with puzzles and games
- How it is used
- Uses immutability to explain string replacement, safe state representation, and the contrast between tuples and mutable lists.
- How deep it goes
- Demonstrates failed assignments, reconstruction, list conversion, and named-tuple safety without examining Python object internals.
- Examples
- Shows string replacement, random character mutation, shuffled word middles, dictionary keys, and tic-tac-toe state tuples.
- What you can do after
- Apply immutability by rebuilding strings, converting them to editable lists, or choosing tuples and named tuples for protected state.
The Quick Python Book, Fourth Edition
Immutability is the property of an object or data structure that prevents its contents from being changed after creation.
- How it is used
- Uses immutable collections to keep tuple elements fixed and to provide eligible dictionary keys and set members.
- How deep it goes
- Demonstrates indexing, failed assignment, conversion, and nested mutability; explains hashability requirements without detailing hash-table internals.
- Examples
- Shows tuple indexing and assignment errors, list-to-tuple conversion, string editing through a list, and a dictionary-key eligibility table.
- What you can do after
- Apply it via Python's tuple and frozenset types to choose fixed collections and check whether a proposed dictionary key qualifies.
Read how The Quick Python Book, Fourth Edition explains immutable collection →
Get Programming: Learn to code with Python
- How it is used
- Distinguishes collections that cannot change from lists and dictionaries that can, then explains why dictionary keys must be immutable.
- How deep it goes
- Defines immutability and explains variable rebinding through memory diagrams; contrasts it with direct changes to a list.
- Examples
- Uses a grocery list, memory diagrams, and dictionary key lookups to contrast replacing an object with changing one.
- What you can do after
- Evaluate/understand whether an assignment replaces a collection or modifies it, and why dictionary keys must remain unchanged.
Read how Get Programming: Learn to code with Python explains immutable collection →
Kotlin in Action, 2E
Immutability is the property that an object's state cannot change after the object is created.
- How it is used
- Supports functional programming by keeping shared state stable for simpler testing, reasoning, and multithreaded code.
- How deep it goes
- Distinguishes immutable collections from read-only views and explains aliasing, thread-safety limits, and immutable data-class updates.
- Examples
- Uses collection source-and-target typing and a Customer data-class copy with a changed postal code.
- What you can do after
- Evaluate/understand whether Kotlin collection access is truly immutable or merely read-only, and choose copying or synchronization accordingly.
Read how Kotlin in Action, 2E explains immutable collection →
Python How-To
Immutability is the property of a data structure or object whose contents cannot be changed after creation.
- How it is used
- Signals fixed data with tuples while reserving lists for collections that need updates.
- How deep it goes
- Explains rejected tuple updates and the limit posed by mutable inner objects; also shows frozen data-class fields.
- Examples
- Uses fixed task metadata, failed tuple assignments, mutation of a list inside a tuple, and a frozen data-class assignment error.
- What you can do after
- Practice/perform it by choosing tuples for fixed data, lists for changing data, and frozen data classes for fields that should not change.
Elixir in Action, Third Edition
Immutable data is data whose value cannot be changed after it has been created, so modifications produce new versions instead of altering existing values.
- How it is used
- Uses immutable transformations to organize Elixir programs into composable functions and preserve consistent data versions.
- How deep it goes
- Explains rebinding, side effects, structural sharing, list and tuple costs, and recursive hierarchical updates without descending into runtime implementation.
- Examples
- Demonstrates tuple replacement, list construction, pipelined transformations, and nested to-do-list updates with put_in.
- What you can do after
- Apply it via Elixir transformations, pipelines, rebinding, and put_in updates while retaining earlier data versions.
Read how Elixir in Action, Third Edition explains immutable collection →
Learn Go with Pocket-Sized Projects
Immutability is the property of a value or object whose state cannot be changed after construction.
- How it is used
- Uses immutability to represent safe, predictable value objects such as money and calculated calendar periods.
- How deep it goes
- Explains hidden fields, construction, derived methods, and thread safety, but does not detail collection-specific mutation mechanisms.
- Examples
- Demonstrates immutable Currency, Amount, Decimal, and FormattedWeek values with hidden fields and read-only methods.
- What you can do after
- Build it from scratch in Go by hiding fields, constructing complete values, and exposing non-mutating methods.
Read how Learn Go with Pocket-Sized Projects explains immutable collection →
100 C++ Mistakes and How to Avoid Them
Immutable data is data whose value cannot be changed after it has been created.
- How it is used
- Uses immutability to preserve the invariant of value-like classes such as Rational.
- How deep it goes
- Explains mutation decisions through Rational design, then stops short of a general immutability framework.
- Examples
- Uses a Rational class with setters, denominator validation, reduction, addition, and multiplication.
- What you can do after
- Evaluate value-like class interfaces and replace unnecessary mutation with construction-time validation and result-producing operations.
Read how 100 C++ Mistakes and How to Avoid Them explains immutable collection →
The Well-Grounded Rubyist, Fourth Edition
Immutability is the property of data or objects that prevents their state from being changed after creation.
- How it is used
- Uses immutability to discuss safer Ruby code and functional programming, including situations involving multiple threads.
- How deep it goes
- Explains symbol immutability, Ruby freezing, and frozen strings, while warning that freezing does not guarantee all attributes are immutable.
- Examples
- Uses symbols, a frozen Record instance, a mutable string constant, and frozen string literals with mutable copies.
- What you can do after
- Operate on Ruby objects with `freeze` and `frozen?`, and create mutable string copies with `dup`, `String.new`, or unary `+`.
Read how The Well-Grounded Rubyist, Fourth Edition explains immutable collection →
Apache Kafka in Action
Immutability is the property of data that prevents its existing contents from being changed or removed after creation.
- How it is used
- Uses immutability to preserve ordered histories and safely exchange data across service boundaries.
- How deep it goes
- Explains the property through logs, debugging, restoration, and service coupling, without detailing collection implementation.
- Examples
- Uses a diary, application logs, database commit logs, and data exchanged between services as concrete examples.
- What you can do after
- Evaluate/understand how immutable histories support debugging, state restoration, and independent service evolution.
Read how Apache Kafka in Action explains immutable collection →
100 Go Mistakes and How to Avoid Them
Immutability is the property that a value or data object cannot be changed after creation.
- How it is used
- Diagnoses allocation and copying costs caused by treating immutable strings as mutable accumulation buffers.
- How deep it goes
- Explains immutability through allocation behavior, byte copying, builder buffering, preallocation, and conversion examples.
- Examples
- Uses repeated concatenation, strings.Builder, Builder.Grow, byte-slice sanitization, and a byte-to-string mutation experiment.
- What you can do after
- Diagnose unnecessary allocations and choose strings.Builder or byte-slice processing for appropriate workflows.
Read how 100 Go Mistakes and How to Avoid Them explains immutable collection →
Deep Learning with JAX
The property of values not being modified in place after creation, as emphasized for JAX arrays here.
- How it is used
- Uses immutable array updates to support pure functions and JAX transformations.
- How deep it goes
- Explains the mutation error, functional replacements, and efficiency caveats, but defers a full treatment of functional programming.
- Examples
- Demonstrates NumPy assignment, JAX assignment failure, .at[].set updates, and out-of-bounds indexing modes.
- What you can do after
- Apply JAX's .at[] API to replace common in-place array updates with functionally pure expressions.
Read how Deep Learning with JAX explains immutable collection →
React Quickly, Second Edition
Data whose existing structures are not modified, with changes represented by creating new structures.
- How it is used
- Uses immutable data to support declarative programming and read-only React component properties.
- How deep it goes
- Defines mutation versus new-structure creation, demonstrates filtering, and stops short of advanced immutable-data techniques.
- Examples
- Uses password filtering, array push as a contrast, and frozen props inspected with Object.isFrozen().
- What you can do after
- Apply it via array filter to derive results without editing the original collection or React props.
Read how React Quickly, Second Edition explains immutable collection →
Object-Oriented Software Design in C++
An immutable object is an object whose observable state cannot be changed after it is created.
- How it is used
- Uses immutability to protect employee records and illustrate implementation hiding through controlled object access.
- How deep it goes
- Descends from absent setters to pointer-based change leaks, then demonstrates copy-based remedies.
- Examples
- Uses Date objects and Employee birthdates, testing external and getter-returned pointers before and after copying.
- What you can do after
- Diagnose/debug with it by finding pointer-based change leaks and applying defensive copies at construction and access.
Read how Object-Oriented Software Design in C++ explains immutable collection →
Advanced Algorithms and Data Structures
Immutability is the property that an existing object or data structure cannot be changed after creation, so updates produce a new structure or version.
- How it is used
- Reduces shared state in parallel computation and lets readers access shared resources without locks.
- How deep it goes
- Defines updates as new structures and explains concurrency benefits and trade-offs, without detailing an immutable collection implementation.
- Examples
- Uses appending to a list and updating a cache to illustrate creating new structures.
- What you can do after
- Understand how immutability affects concurrent reads, shared state, and the cost of updates.
Read how Advanced Algorithms and Data Structures explains immutable collection →
Related concepts
- statecontrasts with · State is information or a configuration describing the condition of a system, entity, or computation at a particular time and potentially influencing subsequent behavior or decisions.
- mutable objectcontrasts with · A mutable object is an object whose state can be changed after it is created.
- read-only collection interfacecontrasts with · A read-only collection interface exposes collection contents and traversal operations without exposing mutation operations through that interface.
- objectkind of · A computational object is a runtime entity or structured value representing data, state, or a resource, with properties or operations defined by its programming model.
- value objectincludes · A value object is an object whose meaning and equality derive from its attribute values rather than an independent identity, typically with immutable state.
- bindingcontrasts with · Name binding is the association of an identifier with the program entity or value it denotes.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.























