On 06/07/2013 02:18 PM, Otávio Gonçalves de Santana wrote: > Inefficient use StringBuffer or StringBuilder[Optimization|clean-up] > > The string addition in the parameter will create another string buffer, > append all the components, then convert that to a string so the you can be > appended to your string buffer. > > So I replace this: > > sb.append(" xxx: [" + getXXX() + "]\n"); > > for this: > > sb.append(" xxx: [").append(getXXX()).append("]\n");
Hmm. I wonder that a JIT can't do this automatically. Perhaps it already does; I haven't looked. Andrew.