public static <T> Optional<T> coalesce(final T val1, final T val2, final T val3) {
        return val1 != null
                ? Optional.of(val1)
                : (val2 != null
                        ? Optional.of(val2)
                        : (val3 != null
                                ? Optional.of(val3)
                                : Optional.empty()));
    }
Return first non-null value or an empty {@link Optional} if all are null
stroom-util-shared/src/main/java/stroom/util/shared/NullSafe.java