Tiny optimization that makes header addition faster in most cases

This commit is contained in:
Trustin Lee 2009-06-15 07:06:53 +00:00
parent 8debedf6b6
commit 5fb8e8069b

View File

@ -60,7 +60,7 @@ public class DefaultHttpMessage implements HttpMessage {
throw new NullPointerException("value is null");
}
if (headers.get(name) == null) {
headers.put(name, new ArrayList<String>());
headers.put(name, new ArrayList<String>(1));
}
headers.get(name).add(value);
}