public static <T> boolean equalIfBothPresent(Optional<T> first, Optional<T> second) {
        return first.isEmpty() || second.isEmpty() || first.equals(second);
    }
Returns whether either optional is empty, or both are present and equal.
vespajlib/src/main/java/com/yahoo/collections/Optionals.java