You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2020/11/23 23:37:17 UTC

[httpcomponents-core] 03/06: Use Collections.addAll() API instead of loops.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch 4.4.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit 19a40a362b35efda05bd181845676bdcbcdd91ca
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 23 12:02:10 2020 -0500

    Use Collections.addAll() API instead of loops.
---
 .../src/main/java/org/apache/http/ssl/SSLContextBuilder.java     | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 289737d..816c567 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -46,6 +46,7 @@ import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
@@ -232,9 +233,7 @@ public class SSLContextBuilder {
                     }
                 }
             }
-            for (final TrustManager tm : tms) {
-                this.trustManagers.add(tm);
-            }
+            Collections.addAll(this.trustManagers, tms);
         }
         return this;
     }
@@ -310,9 +309,7 @@ public class SSLContextBuilder {
                     }
                 }
             }
-            for (final KeyManager km : kms) {
-                keyManagers.add(km);
-            }
+            Collections.addAll(keyManagers, kms);
         }
         return this;
     }