Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 3
    Possible duplication of stackoverflow.com/questions/2439243/… Commented Sep 17, 2012 at 11:31
  • It will be faster. I don't know why I get Out of Memory with StringBuffer. Now, I am taking reference in stackoverflow.com/questions/2439243/… Commented Sep 17, 2012 at 11:37
  • StringBuffer is faster so you may run out of memory faster. You should check how many results got stored in each case to see if it's the problem with speed difference or the memory usage difference between String and StringBuffer Commented Sep 17, 2012 at 11:37
  • I would add that StringBuffer was replaced in Java 5.0 eight years ago by StringBuilder but String is still used today. Commented Sep 17, 2012 at 11:49
  • This will make you understand the concepts clearly Commented Jul 25, 2013 at 6:39