public static < T > T notNull ( T argument , String argumentName ) { if ( argument == null ) { throw new IllegalArgumentException ( "Argument " + argumentName + " must not be null." ) ; } return argument ; }
Checks if the given argument is null and throws an exception with a message containing the argument name if that it true .