title: JVM smart enought to optimize vararg array?
body: <p>Given we have a method like this and we want to be as fast and memory efficient as possible. Is it likely that JVM will be smart enought to optimize this into simple string builder appends and avoid creating Object[] for varargs and avoid autoboxing primitives into Object for that object array?</p>
  
  <pre><code>protected String stringId(Object... things) {
      final StringBuilder sb = new StringBuilder();
  
      for (Object thing : things) {
          if(sb.length() &gt; 0) {
              sb.append('-');
          }
          sb.append(String.valueOf(thing));
      }
  
      return sb.toString();
  }
  </code></pre>