Just Don’t Return null!. On my article Avoid Explicit null… | by JAVING | Javarevisited – Medium

npressfetimg-3449.png

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…

Source: https://medium.com/javarevisited/just-dont-return-null-dcdf5d77128f