[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul Lindner closed HTTPCLIENT-770.
-----------------------------------


looks good, thanks.

btw, single-char vs string is mostly a memory issue.  A char constant can be 
stored in 2 bytes, a string requires something like 24 bytes + 2 bytes for the 
actual characters.

Also consider the common case of appending a char and you can see there is a 
little bit less work involved:

public AbstractStringBuilder JavaDoc append(char c) {
     int newCount = count + 1;
     if (newCount > value.length)
         expandCapacity(newCount);
     value[count++] = c;
     return this;
 }

vs

public AbstractStringBuilder  append(String str) {
     if (str == null) str = "null";
     int len = str.length();

     if (len == 0) return this;
     int newCount = count + len;
     if (newCount > value.length)
         expandCapacity(newCount);
     str.getChars(0, len, value, count);
     count = newCount;
     return this;
 }


> Code cleanups for Java 1.5 and more.
> ------------------------------------
>
>                 Key: HTTPCLIENT-770
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-770
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>            Reporter: Paul Lindner
>            Priority: Minor
>             Fix For: 4.0 Alpha 4
>
>         Attachments: httpclient-cleanups.patch
>
>
> I can't resist giving code a good cleansing when I start hacking.  Here's 
> some simple things:
> - Use character constants instead of string contstants
> - Use java 1.5 style for loops
> - Use StringBuilder where appropriate
> - Fix javadocs
> - switch somestring.equals("") to .length() == 0
> -  simplify some boolean expressions
> - eliminate redundant initializers
> - fix some html nits
> - remove final keyword from static methods

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to