cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <>
Subject RE: Check this!
Date Thu, 17 Feb 2000 18:35:33 GMT
On Thu, 17 Feb 2000, COFFMAN Steven wrote:

> >From the article:
> "Among these pitfalls are the excessive use of strings, which in the Java
> language are immutable objects, and excessive use of exceptions"
> Each time you modify a String ("Hello" to "olleH") you basically create a
> new object and recycle the old one. I see how this is less efficient then
> merely modifying the bytes in a previously allocated array of characters,
> but what alternative is there in Java? FOP uses StringBuffer all over the
> place, but I thought that was *worse* than String. Are Java arrays of chars
> better? 

StringBuffers and StringWriters are better when you're building strings.
character arrays are possibly better when you're modifying strings, but I
don't believe in using them much myself. StringCharacterIterators and
StringReaders are good when you're iterating over strings.

- donald

View raw message