title: When to use StringBuilder in Java
body: <p>It is supposed to be generally preferable to use a <code>StringBuilder</code> for string concatenation in Java. Is this always the case?</p>
  
  <p>What I mean is this: Is the overhead of creating a <code>StringBuilder</code> object, calling the <code>append()</code> method and finally <code>toString()</code> already smaller then concatenating existing strings with the <code>+</code> operator for two strings, or is it only advisable for more (than two) strings?</p>
  
  <p>If there is such a threshold, what does it depend on (perhaps the string length, but in which way)?</p>
  
  <p>And finally, would you trade the readability and conciseness of the <code>+</code> concatenation for the performance of the <code>StringBuilder</code> in smaller cases like two, three or four strings?</p>
  
  <p>Explicit use of <code>StringBuilder</code> for regular concatenations is being mentioned as obsolete at <a href="https://stackoverflow.com/questions/4019180/obsolete-java-optimization-tips">obsolete Java optimization tips</a> as well as at <a href="https://stackoverflow.com/questions/2248278/java-urban-myths">Java urban myths</a>.</p>