Handling Nulls in nested objects (Java)

1 · Lalit Prakash Vatsal · March 29, 2020, 9:14 a.m.
Handling NullPointerException and keeping track of all the nullable values has always been a pain for Java developers. This is even worse when you are working with deeply nested objects and handling all the null values grows exponentially with each nullable nested value. This is visible by all the statements like: if (x.y().z().. != null) {…} In this article, we will explore some of the techniques starting with the naive approach to a more advanced one for handling such scenarios.So, are you re...