public static <T> boolean emptyOrEqual(Optional<T> optional, T value) {
        return optional.isEmpty() || optional.equals(Optional.of(value));
    }
Returns whether the optional is empty, or present and equal to the given value.
vespajlib/src/main/java/com/yahoo/collections/Optionals.java