Use Collections.addAll() and Collection.addAll() APIs instead of loops.

This commit is contained in:
Gary Gregory 2020-11-23 12:02:05 -05:00 committed by Gary Gregory
parent 50ec2d075d
commit 3334f2d447
3 changed files with 5 additions and 12 deletions

View File

@ -38,6 +38,7 @@ import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
@ -112,9 +113,7 @@ public class SSLContextBuilder {
}
}
}
for (final TrustManager tm : tms) {
this.trustmanagers.add(tm);
}
Collections.addAll(this.trustmanagers, tms);
}
return this;
}
@ -151,9 +150,7 @@ public class SSLContextBuilder {
}
}
}
for (final KeyManager km : kms) {
keymanagers.add(km);
}
Collections.addAll(keymanagers, kms);
}
return this;
}

View File

@ -410,9 +410,7 @@ public class URIBuilder {
} else {
this.queryParams.clear();
}
for (final NameValuePair nvp: nvps) {
this.queryParams.add(nvp);
}
Collections.addAll(this.queryParams, nvps);
this.encodedQuery = null;
this.encodedSchemeSpecificPart = null;
this.query = null;

View File

@ -82,9 +82,7 @@ public class DefaultHttpRequestRetryHandler implements HttpRequestRetryHandler {
this.retryCount = retryCount;
this.requestSentRetryEnabled = requestSentRetryEnabled;
this.nonRetriableClasses = new HashSet<Class<? extends IOException>>();
for (final Class<? extends IOException> clazz: clazzes) {
this.nonRetriableClasses.add(clazz);
}
this.nonRetriableClasses.addAll(clazzes);
}
/**