hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1544988 - /httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java
Date Sun, 24 Nov 2013 15:03:51 GMT
Author: sebb
Date: Sun Nov 24 15:03:51 2013
New Revision: 1544988

URL: http://svn.apache.org/r1544988
Log:
Document why the for-each loop is not used here

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

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java?rev=1544988&r1=1544987&r2=1544988&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java
Sun Nov 24 15:03:51 2013
@@ -104,6 +104,9 @@ public class HeaderGroup implements Clon
         if (header == null) {
             return;
         }
+        // HTTPCORE-361 : we don't use the for-each syntax, i.e.
+        //     for (Header header : headers)
+        // as that creates an Iterator that needs to be garbage-collected
         for (int i = 0; i < this.headers.size(); i++) {
             final Header current = this.headers.get(i);
             if (current.getName().equalsIgnoreCase(header.getName())) {
@@ -171,6 +174,9 @@ public class HeaderGroup implements Clon
      */
     public Header[] getHeaders(final String name) {
         final List<Header> headersFound = new ArrayList<Header>();
+        // HTTPCORE-361 : we don't use the for-each syntax, i.e.
+        //     for (Header header : headers)
+        // as that creates an Iterator that needs to be garbage-collected
         for (int i = 0; i < this.headers.size(); i++) {
             final Header header = this.headers.get(i);
             if (header.getName().equalsIgnoreCase(name)) {
@@ -241,6 +247,9 @@ public class HeaderGroup implements Clon
      * contained, <code>false</code> otherwise
      */
     public boolean containsHeader(final String name) {
+        // HTTPCORE-361 : we don't use the for-each syntax, i.e.
+        //     for (Header header : headers)
+        // as that creates an Iterator that needs to be garbage-collected
         for (int i = 0; i < this.headers.size(); i++) {
             final Header header = this.headers.get(i);
             if (header.getName().equalsIgnoreCase(name)) {



Mime
View raw message