You should use a StringBuffer
or a StringBuilder
.
When you add Strings with plus, a StringBuilder
is created, strings are concatenated and a new String is return with toString()
method of the StringBuilder
. So image this object creation and string manipulation 50k times. It's much better if you instantiate only one StringBuilder
yourself and just append strings...
This answer could be of use to you: concatenation operator (+) vs concat()