title: Performance between String.format and StringBuilder
body: <p>To concatenate <code>String</code> we often use <code>StringBuilder</code> instead of <code>String</code> + <code>String</code>, but also we can do the same with <code>String.format</code> which returns the formatted string by given locale, format and arguments.</p>
  
  <p>Examples:</p>
  
  <p><strong>Concatenate the string with StringBuilder</strong></p>
  
  <pre><code>String concatenateStringWithStringBuilder(String name, String lName, String nick) {
      final StringBuilder sb = new StringBuilder("Contact {");
      sb.append(", name='").append(name)
        .append(", lastName='").append(lName)
        .append(", nickName='").append(nick)
        .append('}');
      return sb.toString();
  }
  </code></pre>
  
  <p><strong>Concatenate the string with StringFormat:</strong></p>
  
  <pre><code>String concatenateStringWithStringFormat(String name, String lName, String nick) {
      return String.format("Contact {name=%s, lastName=%s, nickName=%s}", name, lName, nick);
  }
  </code></pre>
  
  <p>In performance, is <code>String.Format</code> as efficient as <code>StringBuilder</code>? Which one is better to concatenate strings and why?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I checked the similar <a href="https://stackoverflow.com/questions/513600/should-i-use-javas-string-format-if-performance-is-important">question</a>, but doesn´t answer my question. So far I have used <code>StringBuilder</code> to concatenate strings, should I follow it using? Or should I use <code>String.format</code>? the question is which one is better and why?</p>