public static <T> void maybeMergeOptions(Properties props, String key, OptionSet options, OptionSpec<T> spec) {
        if (options.has(spec) || !props.containsKey(key)) {
            T value = options.valueOf(spec);
            if (value == null) {
                props.remove(key);
            } else {
                props.put(key, value.toString());
            }
        }
    }
Merge the options into {@code props} for key {@code key}, with the following precedence, from high to low:
1) if {@code spec} is specified on {@code options} explicitly, use the value;
2) if {@code props} already has {@code key} set, keep it;
3) otherwise, use the default value of {@code spec}.
A {@code null} value means to remove {@code key} from the {@code props}.
server-common/src/main/java/org/apache/kafka/server/util/CommandLineUtils.java