You have a point. My example probably oversimplified the scenario. In actual case, there’s quite a bit of check

this.check1() && this.check2() && this.check3() && this.check4()

Hence checking this != null at the start should simplify all without need to have Elvis operator on all of them.

Written by

Passionate about learning, and sharing mobile development and others

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