Alan McMorran <email@hidden> wrote:
>I had originally made it do:
>
>String ret = new String();
>
>For (int I=0; I<objects.length; I++){
> ret += objects[I].outputXML() + "\n";
>}
>
>Return ret;
>
>Then put the string into a file, but the time taken increased exponentially
>as the number of objects increased.
That's because the code is actually creating a new StringBuffer or two each
time around the loop, using it temporarily, then leaving it for GC. This
is one of the worst possible ways to build up a String. Use
StringBuffer.append() instead, on a single StringBuffer.
>P.S. Just noticed Entourage insists on capitalising various commands in the
>above code, but you get the general idea.
There's probably a setting to turn it off. If not, file a bug-report with MS.
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden