public static void initializeBootstrapProperties(
        Properties properties,
        Optional<String> bootstrapServer,
        Optional<String> bootstrapControllers
    ) {
        if (bootstrapServer.isPresent()) {
            if (bootstrapControllers.isPresent()) {
                throw new InitializeBootstrapException("You cannot specify both " +
                        "--bootstrap-controller and --bootstrap-server.");
            }
            properties.setProperty(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG,
                    bootstrapServer.get());
            properties.remove(AdminClientConfig.BOOTSTRAP_CONTROLLERS_CONFIG);
        } else if (bootstrapControllers.isPresent()) {
            properties.remove(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG);
            properties.setProperty(AdminClientConfig.BOOTSTRAP_CONTROLLERS_CONFIG,
                    bootstrapControllers.get());
        } else {
            throw new InitializeBootstrapException("You must specify either --bootstrap-controller " +
                    "or --bootstrap-server.");
        }
    }
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