Repository: netty/netty
File: handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java (Java)

Code before:
    private TrustManagerFactory trustManagerFactory;
    private X509Certificate[] keyCertChain;
    private PrivateKey key;
    private String keyPassword;
    private KeyManagerFactory keyManagerFactory;
    private Iterable<String> ciphers;
    private CipherSuiteFilter cipherFilter = IdentityCipherSuiteFilter.INSTANCE;
    private ApplicationProtocolConfig apn;
    private long sessionCacheSize;
    private long sessionTimeout;
    private ClientAuth clientAuth = ClientAuth.NONE;
    private String[] protocols;
    private boolean startTls;
    private boolean enableOcsp;
    private SecureRandom secureRandom;
    private String keyStoreType = KeyStore.getDefaultType();
    private String endpointIdentificationAlgorithm;
    private final Map<SslContextOption<?>, Object> options = new HashMap<SslContextOption<?>, Object>();
    private final List<SNIServerName> serverNames;

    private SslContextBuilder(boolean forServer) {
        this.forServer = forServer;
        if (!forServer) {
            endpointIdentificationAlgorithm = SslUtils.defaultEndpointVerificationAlgorithm;
        }
        serverNames = forServer ? null : new ArrayList<>(); // Only for clients.
    }

    /**
     * Configure a {@link SslContextOption}.
     */
    public <T> SslContextBuilder option(SslContextOption<T> option, T value) {
        if (value == null) {
            options.remove(option);
        } else {
            options.put(option, value);
        }
        return this;
    }

    /**
     * The {@link SslContext} implementation to use. {@code null} uses the default one.
     */
    public SslContextBuilder sslProvider(SslProvider provider) {
        this.provider = provider;
        return this;
    }

    /**
     * Sets the {@link KeyStore} type that should be used. {@code null} uses the default one.
     */

Review comment (suggestion):
nit: Maybe just use a smaller list by default
```suggestion
        serverNames = forServer ? null : new ArrayList<>(2); // Only for clients.
```

Code after:
    private TrustManagerFactory trustManagerFactory;
    private X509Certificate[] keyCertChain;
    private PrivateKey key;
    private String keyPassword;
    private KeyManagerFactory keyManagerFactory;
    private Iterable<String> ciphers;
    private CipherSuiteFilter cipherFilter = IdentityCipherSuiteFilter.INSTANCE;
    private ApplicationProtocolConfig apn;
    private long sessionCacheSize;
    private long sessionTimeout;
    private ClientAuth clientAuth = ClientAuth.NONE;
    private String[] protocols;
    private boolean startTls;
    private boolean enableOcsp;
    private SecureRandom secureRandom;
    private String keyStoreType = KeyStore.getDefaultType();
    private String endpointIdentificationAlgorithm;
    private final Map<SslContextOption<?>, Object> options = new HashMap<SslContextOption<?>, Object>();
    private final List<SNIServerName> serverNames;

    private SslContextBuilder(boolean forServer) {
        this.forServer = forServer;
        if (!forServer) {
            endpointIdentificationAlgorithm = SslUtils.defaultEndpointVerificationAlgorithm;
        }
        serverNames = forServer ? null : new ArrayList<>(2); // Only for clients.
    }

    /**
     * Configure a {@link SslContextOption}.
     */
    public <T> SslContextBuilder option(SslContextOption<T> option, T value) {
        if (value == null) {
            options.remove(option);
        } else {
            options.put(option, value);
        }
        return this;
    }

    /**
     * The {@link SslContext} implementation to use. {@code null} uses the default one.
     */
    public SslContextBuilder sslProvider(SslProvider provider) {
        this.provider = provider;
        return this;
    }

    /**
     * Sets the {@link KeyStore} type that should be used. {@code null} uses the default one.
     */