Browse - Programming Tips - Should I use StringBuffer or StringBuilder?

Date: 2011sep28
Updated: 2014mar24
Language: Java

Q.  Should I use StringBuffer or StringBuilder?

A.  Unless you need the buffer to be thread-safe use StringBuilder --
its is faster.

Also if you want to use Matcher's appendReplacement() and appendTail()
you need to use StringBuffer.

But usually you just want something faster than string + string
so use StringBuilder.