Java tutorial
//package com.java2s; import android.support.annotation.Nullable; public class Main { public static <T> T checkNullArgument(T reference, @Nullable Object errorMessage) { if (reference == null) { throw new IllegalArgumentException(String.valueOf(errorMessage)); } return reference; } }