Tagged articles
1 articles
Page 1 of 1
Selected Java Interview Questions
Selected Java Interview Questions
Feb 17, 2021 · Backend Development

Handling Null Values in Java: Empty Collections, Optional, and Null‑Object Pattern

This article explains common null‑handling pitfalls in Java backend code, demonstrates why returning empty collections or Optional is safer than null, shows how to use JSR‑303/JSR‑305 annotations and the Null‑Object pattern, and provides practical guidelines for method signatures and bean getters.

design-patternsjsr303jsr305
0 likes · 14 min read
Handling Null Values in Java: Empty Collections, Optional, and Null‑Object Pattern