efficiency « StringBuffer « Java Data Type Q&A





1. Question about StringBuffer efficiency    coderanch.com

It does make a difference if they're all literals; if they are, the "+" can be done by the compiler, so at runtime there's just one String to append; that makes the + version a bit more efficient. If they're not then the three-append version is better; the +'s will be compiled into the creation of another StringBuffer and some more ...