public static Optional<String> toOptional(String str) {
        return str == null || str.isEmpty() ? Optional.empty() : Optional.of(str);
    }
@return An Optional containing the provided string if it is not null and not empty,
        otherwise an empty Optional.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Utils.java