wood burning stoves 2.0*
The moose likes Cattle Drive and the fly likes Question about StringBuffer in Times Assignment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Question about StringBuffer in Times Assignment " Watch "Question about StringBuffer in Times Assignment " New topic
Author

Question about StringBuffer in Times Assignment

juliane gross
Ranch Hand

Joined: May 30, 2002
Posts: 161
I am not so sure what to make of the assignment's hint "if speed is important to you,
the first thing you would want to change is to use a StringBuffer as temporary storage".
I just also experimented with StringBuffer, then,
which worked fine, too.
But whether or how the program is speed up this way I cannot distinguish.
Any suggestions? thanks.
Juliane
Peter Berquist
Greenhorn

Joined: Jun 10, 2002
Posts: 6
Juliane,
Take a look at this discussion, especially the part at the end where Marilyn suggests reading the source code for the String class.
When I read the source code, the difference between String and StringBuffer started making sense.
Also this post on optimization.
Darryl Failla
Ranch Hand

Joined: Oct 16, 2001
Posts: 128
You may not see any difference running this operation one time, but put it in a loop that does it 100 times. You should see a difference then.


Darryl Failla
Sun Certified Java 2 Programmer
juliane gross
Ranch Hand

Joined: May 30, 2002
Posts: 161
thanks, peter and darryl,
that helped.
juliane
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about StringBuffer in Times Assignment
 
Similar Threads
StringBuffer and equals()
Array Speed Issue
StringBuffer
in what condition the equls to compare whether the two are the same object?
What is the reason ?