title: Why StringBuilder append() faster than LinkedList add()?
body: <p>I'm trying to create new StringBuilder based on LinkedList structure.</p>
  
  <p>As you know Java's StringBuilder append() operation works like array list add() operation(resizing value-array when capacity exceeds).</p>
  
  <p>I realised that when inserting <code>String</code>, <code>StringBuilder.append()</code> faster than <code>LinkedList.add()</code></p>
  
  <p>(*It's a pure adding process for list).</p>
  
  <p>Here is the code snippet:</p>
  
  <pre><code>        List&lt;String&gt; linkedList = new LinkedList&lt;&gt;();
          StringBuilder stringBuilder = new StringBuilder();
  
          int loopCount = 5_000_000;
  
          long s, e;
  
          s = System.currentTimeMillis();
          for (int i = 0; i &lt; loopCount; i++) {
              linkedList.add(UUID.randomUUID().toString() + "\n");
          }
          e = System.currentTimeMillis();
          System.out.println("LinkedList: "+(e - s));
  
          s = System.currentTimeMillis();
          for (int i = 0; i &lt; loopCount; i++) {
              stringBuilder.append(UUID.randomUUID().toString() + "\n");
          }
          e = System.currentTimeMillis();
          System.out.println("String Builder: " + (e - s));
  </code></pre>
  
  <p>Those are the benchmark results.(Based on 5 million insertion)</p>
  
  <pre><code>StringBuilder: 13892 millisec
  LinkedList:    19561 millisec
  </code></pre>
  
  <p>Also I changed add() method with <code>ListIterator.add()</code> but I did not change anything.</p>
  
  <p>Here is my question: How can I achieve that list add() method become way faster than <code>StringBuilder.append()</code>?</p>