title: Does String concatenation get optimized to use existing StringBuilders?
body: <p>I have the following code:</p>
  
  <pre><code>StringBuilder str = new StringBuilder("foo");
  for(Field f : fields){
      str.append("|" + f);
  }
  str.append("|" + bar);
  String result = str.toString();
  </code></pre>
  
  <p>I know compiler will optimize string concatenation <code>"|" + f</code> and replace it with StringBuilder. However will a new StringBuilder be created or the existing <code>str</code> will be used in Java 8? How about Java 9?</p>