Null handling
Null handling is the practice of determining whether a reference or value is null or absent and deciding how to proceed before using it.
High Performance Unity Game Development
A null check is a test that determines whether a reference or object represents no value or has been invalidated.
- How it is used
- Avoids repeated Unity-object validity checks in hot gameplay paths while managing object lifetime.
- How deep it goes
- Compares checked and unchecked GameObject access, reports an Android slowdown, and gives strategies for limiting checks.
- Examples
- Uses GameObject position-setting methods, editor-assigned assets, and stars destroyed while a tween is still running.
- What you can do after
- Apply lifetime ownership and check-once strategies to reduce repeated Unity-object checks during gameplay.
Read how High Performance Unity Game Development explains null handling →
100 Java Mistakes and How to Avoid Them
A null check is a condition that tests whether a reference has the null value.
- How it is used
- Prevents misleading null checks and reduces unexpected NullPointerException failures in ordinary and concurrent Java code.
- How deep it goes
- Explains operator precedence, prevention practices, nullability strategies, and atomic queue handling without developing a complete nullability type system.
- Examples
- Uses faulty string formatting, ArrayList capacity arithmetic, queue polling, ConcurrentMap.merge, and AtomicInteger.updateAndGet examples.
- What you can do after
- Diagnose/debug with precedence-aware inspection, static analyzers, local null checks, and atomic collection methods.
Read how 100 Java Mistakes and How to Avoid Them explains null handling →
The Art of Code
A null check is a conditional test that determines whether a reference or value is absent before it is accessed.
- How it is used
- Improves readable, maintainable navigation through data that may be absent.
- How deep it goes
- Compares nested checks with nullable types, safe navigation, mapping, and fallbacks, but stops short of detailed language semantics.
- Examples
- Uses product pricing and user-address navigation to contrast nested Java checks with Kotlin and Optional-based alternatives.
- What you can do after
- Apply null-safe navigation and explicit fallbacks while keeping business intent visible to callers and maintainers.
Also covered in
What to know first
- type systemA type system is a set of rules that classifies program values and expressions and constrains their valid uses and operations.
- missing valueA missing value is an expected data value or observation that is absent, unavailable, unknown, or inapplicable.
- nullNull is a special value that represents the absence of an object or valid reference.
Related concepts
- Matchcontrasts with · Match consumes an Option by handling its alternatives through supplied functions or actions.
- safe-call operatoralternative to · A safe-call operator conditionally accesses or invokes an operation through a nullable receiver, producing null when the receiver is null.
- defensive programmingused by · Defensive programming is an approach that anticipates invalid or unexpected inputs, states, and failures and uses checks or safeguards to handle them or limit their effects.
- missing valueused by · A missing value is an expected data value or observation that is absent, unavailable, unknown, or inapplicable.
Questions about null handling
What is null handling?
Null handling is the practice of determining whether a reference or value is null or absent and deciding how to proceed before using it.
Which Manning books explain null handling?
High Performance Unity Game Development, 100 Java Mistakes and How to Avoid Them and The Art of Code.
What should I know before learning null handling?
Manning books that teach null handling usually introduce Java, type system, missing value and null first.
What is the difference between null handling and Match?
Null handling is the practice of determining whether a reference or value is null or absent and deciding how to proceed before using it. Match consumes an Option by handling its alternatives through supplied functions or actions.
What is null handling also called?
Null handling is also called null check.
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.


