liveBook · Manning

Reference equality

Reference equality is equality determined by whether two references designate the same object or instance rather than equivalent values or contents.

How 4 Manning books explain it

Fabulous Adventures in Data Structures and Algorithms

Reference equality determines whether two references identify the same object rather than whether their contained values are equal.

How it is used
Uses object identity for fast checks when memoized construction makes equal structures share an object.
How deep it goes
Works through C# equality pitfalls and a node comparer, but does not examine runtime reference-comparison internals.
Examples
Shows record-backed linked lists, memoized empty quadtrees, directed acyclic word graph nodes, and deferred list operations.
What you can do after
Apply it via C# `ReferenceEquals` and memoized factories when object identity reliably answers an equality or emptiness question.

Read how Fabulous Adventures in Data Structures and Algorithms explains reference equality →

React Quickly, Second Edition

Referential equality is comparison based on whether two references identify the same object rather than whether their contents are equivalent.

How it is used
Uses reference comparison to determine whether React state changed enough to trigger a component re-render.
How deep it goes
Explains the comparison and demonstrates array mutation failure and new-array correction, without detailing React’s rendering internals.
Examples
Demonstrates a broken todo list that mutates its array and a working version that passes a newly constructed array.
What you can do after
Diagnose/debug with it: identify why mutated object or array state fails to re-render and replace it with a new reference.

Read how React Quickly, Second Edition explains reference equality →

100 Java Mistakes and How to Avoid Them

Reference equality is Java's identity comparison of two references to determine whether they denote the same object.

How it is used
Prevents object-comparison bugs caused by substituting identity checks for value comparisons.
How deep it goes
Explains identity semantics, equals() contrast, wrapper caching, and several concrete failure cases.
Examples
Uses cached and uncached Integer values, explicitly constructed Boolean objects, reflection results, and string comparisons.
What you can do after
Diagnose identity-comparison bugs and replace accidental == checks with appropriate value comparisons.

Read how 100 Java Mistakes and How to Avoid Them explains reference equality →

React in Depth

Referential equality is equality determined by whether two values reference the same object or function rather than merely having equivalent contents.

How it is used
Explains how React detects dependency changes and why memoization matters for stable values and functions.
How deep it goes
Defines primitive and object identity, then applies it to dependency arrays, useMemo, and useCallback without broader React internals.
Examples
Uses empty object and array comparisons, dependency-array forms, and memoized employee filtering.
What you can do after
Apply it via React hooks to control recalculation and preserve value or function references across renders.

Read how React in Depth explains reference equality →

Related concepts

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.