If you’ve ever written Java, you’ve almost certainly written null checks. For better or for worse, if (variable == null) shows up everwhere - Hadoop alone has over 6000 of them 1. In many cases, these are purely defensive - a null isn’t really expected to be passed in the normal flow of the code. In this post I’m going to run through a fun little trick that the JVM uses to optimizes such cases. To