public static <T> T ifNull(final T reference, final T defaultValue) {
        if (reference == null) {
            return defaultValue;
        }
        return reference;
    }
public static < T > T ifNull ( final T reference , final T defaultValue ) { if ( reference == null ) { return defaultValue ; } return reference ; }
If our reference is null then return a default value instead.

@param reference the thing to check.
@param defaultValue the default value to return if the above reference is null.
@return the reference if not null, otherwise the default value. Note, if your default value
is null as well then you will get back null, since that is what you asked. Chain with
{@link #assertNotNull(Object, String)} if you want to make sure you have a non-null
value for the default value.