title: Why is Collections.sort() optimised for LinkedList, but is not optimised for ArrayList?
body: <p>Why does <code>Collections.sort()</code> creates an extra object array and performs Tim sort on the array and then finally copies the sorted array back into <code>List</code> object? I know this call is optimized for <code>LinkedList</code>, but won't we lose out on performance for <code>ArrayList</code>?</p>
  
  <p>We could have avoided <code>2n</code> number of operations in converting it into an object array and adding them back to the list. I know that these extra operations wouldn't affect the Big-O of the whole sorting operation, but I believe it could've been further optimised for <code>ArrayList</code>.</p>
  
  <p>Am I missing something here? I'm just trying to understand why the architecture is laid out as such. Thanks.</p>
  
  <p><a href="https://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/util/Collections.java#l164" rel="noreferrer">https://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/util/Collections.java#l164</a></p>