I would like to propose adding this method:

/**
 * Selects the object if not {...@code null}; otherwise fallsback to the
 * specified default object.
 *
 * @param object the object to test
 * @param defaultObject the default object
 * @return the object if not {...@code null}; otherwise the default object
 */
public static Object defaultIfNull(Object object, Object defaultObject) {
    return (object != null) ? object : defaultObject;
}

Paul

Reply via email to