Source:
<code>public Jersey2ApplicationClientFactory build() { ClientBuilder clientBuilder = ClientBuilder.newBuilder(); ClientConfig clientConfig = new ClientConfig(); for (ClientRequestFilter filter : additionalFilters) { clientBuilder.register(filter); } for (Feature feature : features) { clientConfig.register(feature); } addProviders(clientConfig); addSSLConfiguration(clientBuilder); addProxyConfiguration(clientConfig); final String fullUserAgentName = (userAgent == null ? clientName : userAgent) + "/v" + buildVersion(); clientBuilder.register(new ClientRequestFilter() { @Override public void filter(ClientRequestContext requestContext) { requestContext.getHeaders().put(HttpHeaders.USER_AGENT, Collections.<Object>singletonList(fullUserAgentName)); } }); clientConfig.property(ClientProperties.FOLLOW_REDIRECTS, allowRedirect); clientConfig.property(ClientProperties.READ_TIMEOUT, readTimeout); clientConfig.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); clientBuilder.withConfig(clientConfig); clientBuilder.register(new GZipEncoder()); String ip = myInstanceInfo == null ? null : myInstanceInfo.getIPAddr(); final AbstractEurekaIdentity identity = clientIdentity == null ? new EurekaClientIdentity(ip) : clientIdentity; clientBuilder.register(new Jersey2EurekaIdentityHeaderFilter(identity)); JerseyClient jersey2Client = (JerseyClient) clientBuilder.build(); MultivaluedMap<String, Object> additionalHeaders = new MultivaluedHashMap<>(); if (allowRedirect) { <START> additionalHeaders.put(HTTP_X_DISCOVERY_ALLOW_REDIRECT, Arrays.<Object>asList("true")); <END> } if (EurekaAccept.compact == eurekaAccept) { additionalHeaders.put(EurekaAccept.HTTP_X_EUREKA_ACCEPT, Arrays.<Object>asList(eurekaAccept.name())); } return new Jersey2ApplicationClientFactory(jersey2Client, additionalHeaders); }</code><technical_language>able add instead of put avoid list creation. <LINK_0></technical_language>

Target:
public Jersey2ApplicationClientFactory build() { ClientBuilder clientBuilder = ClientBuilder.newBuilder(); ClientConfig clientConfig = new ClientConfig(); for (ClientRequestFilter filter : additionalFilters) { clientBuilder.register(filter); } for (Feature feature : features) { clientConfig.register(feature); } addProviders(clientConfig); addSSLConfiguration(clientBuilder); addProxyConfiguration(clientConfig); final String fullUserAgentName = (userAgent == null ? clientName : userAgent) + "/v" + buildVersion(); clientBuilder.register(new ClientRequestFilter() { @Override public void filter(ClientRequestContext requestContext) { requestContext.getHeaders().put(HttpHeaders.USER_AGENT, Collections.<Object>singletonList(fullUserAgentName)); } }); clientConfig.property(ClientProperties.FOLLOW_REDIRECTS, allowRedirect); clientConfig.property(ClientProperties.READ_TIMEOUT, readTimeout); clientConfig.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); clientBuilder.withConfig(clientConfig); clientBuilder.register(new GZipEncoder()); String ip = myInstanceInfo == null ? null : myInstanceInfo.getIPAddr(); final AbstractEurekaIdentity identity = clientIdentity == null ? new EurekaClientIdentity(ip) : clientIdentity; clientBuilder.register(new Jersey2EurekaIdentityHeaderFilter(identity)); JerseyClient jersey2Client = (JerseyClient) clientBuilder.build(); MultivaluedMap<String, Object> additionalHeaders = new MultivaluedHashMap<>(); if (allowRedirect) { additionalHeaders.add(HTTP_X_DISCOVERY_ALLOW_REDIRECT, "true"); } if (EurekaAccept.compact == eurekaAccept) { additionalHeaders.add(EurekaAccept.HTTP_X_EUREKA_ACCEPT, eurekaAccept.name()); } return new Jersey2ApplicationClientFactory(jersey2Client, additionalHeaders); }