Javarevisited
Published in

Javarevisited

Just Don’t Return null!

On my article Avoid Explicit null Checks i talked about alternative ways to handle a null value that don’t involve explicitly doing null checks.

After writing that article I still felt I needed to emphasize more in explaining that any of those approaches are unnecessary if we Just Don’t Return null! in the first place. Returning null is an invitation for problems, it just takes a missing null check in the calling code…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store