Reference equality
Reference equality is equality determined by whether two references designate the same object or instance rather than equivalent values or contents.
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.
Related concepts
- equality by valuecontrasts with · Equality by value is an equality semantics in which values are considered equal when they represent equivalent contents, regardless of object identity.
- equalityproduced by · Equality is a programming-language relation or operation that determines whether two values are considered equal according to applicable rules.
- operatorimplemented by · An operator is a symbol, keyword, or language construct that specifies an operation on one or more operands.
- Reactused by · React is an open-source JavaScript library for building user interfaces from declarative, reusable components.
- Kotlinimplemented by · Kotlin is a statically typed general-purpose programming language that targets the JVM and other platforms and interoperates with Java.
- exact-match accuracycontrasts with · Exact-match accuracy evaluates outputs by whether they exactly equal their references under specified comparison rules.
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.



