Kev Jackson wrote:

> As I've been hacking away today, I've been swapping a load of "" + "" +
> "" style code over to use StringBuffers.  I thought that perhaps there's 
> a potential use of a static method in StringUtils to construct these 
> strings from an array

Please, don't.

Modern compilers already implement string addition using StringBuffer
(1.4 already have this optimization, I don't remember about earlier
versions).

And 1.5 compiler can do it using StringBuilder which is faster.

if (dirCount >> 0) {
>   String[] args = {"Deleted ", ""+dirCount, " director", (dirCount == 1 
> ? "y" : "ies"), " from ", d.getAbsolutePath()};
>   log(StringUtils.messageAppender(args), quiet ? Project.MSG_VERBOSE : 
> verbosity);
> }

The effects of this are
- the compiler can't optimized string addition
- the code is difficult to read

-- 
Best regards,
 Alexey                            mailto:[EMAIL PROTECTED]


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

Reply via email to