Skip to content

Instantly share code, notes, and snippets.

@thejibz
thejibz / TernaryNullChecking.java
Last active November 27, 2015 16:26
Generate a ternary null checking for a chained call.
/**
* Generate a ternary null checking for a chained call.
* a.getB().getC().getD().getE()
* =>
* (a != null
&& a.getB() != null
&& a.getB().getC() != null
&& a.getB().getC().getD() != null
&& a.getB().getC().getD().getE() != null)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}