hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1698011 - /httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
Date Wed, 26 Aug 2015 21:42:31 GMT
Author: ggregory
Date: Wed Aug 26 21:42:30 2015
New Revision: 1698011

URL: http://svn.apache.org/r1698011
Log:
No need to create a new empty array every time a null parameters array is passed in.

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java?rev=1698011&r1=1698010&r2=1698011&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
Wed Aug 26 21:42:30 2015
@@ -40,6 +40,8 @@ import org.apache.http.util.Args;
 @NotThreadSafe
 public class BasicHeaderElement implements HeaderElement {
 
+    private static final NameValuePair[] EMPTY_NAME_VALUE_PAIR_ARRAY = new NameValuePair[0];
+    
     private final String name;
     private final String value;
     private final NameValuePair[] parameters;
@@ -62,7 +64,7 @@ public class BasicHeaderElement implemen
         if (parameters != null) {
             this.parameters = parameters;
         } else {
-            this.parameters = new NameValuePair[] {};
+            this.parameters = EMPTY_NAME_VALUE_PAIR_ARRAY;
         }
     }
 



Mime
View raw message