@Nonnull
    public static <T> T checkNotNull(T value, @Nonnull String errorMessage) {
        if (value == null) {
            throw new NullPointerException(errorMessage);
        }
        return value;
    }
@ Nonnull public static < T > T checkNotNull ( T value , @ Nonnull String errorMessage ) { if ( value == null ) { throw new NullPointerException ( errorMessage ) ; } return value ; }
Ensures the value is not null.

@param value value to be validated.
@param errorMessage error message thrown if value is null.
@param <T> type of value.
@return value passed in if not null.