import java.util.Objects; // Usage Objects.isNull(); // Or you can create your own isNull() function public static boolean isNull(Object obj) { return obj == null; }