title: Kotlin MutableList initial capacity
body: <p>I'm creating a list of values, in a context where it so happens that, though the values are being added one at a time, the eventual number is known in advance. This is in a function that will be called many times, so the faster it runs, the better.</p>
  
  <p>In Java, I would use the ArrayList constructor that specifies an initial capacity, because in theory this makes it slightly faster because it avoids resizing.</p>
  
  <p>In Kotlin, one normally uses mutableListOf(), but this does not allow an initial capacity; in theory this should result in slightly slower code.</p>
  
  <p>Is the recommended/idiomatic Kotlin solution in this case:</p>
  
  <ol>
  <li>Go ahead and use the ArrayList constructor; ArrayList is a perfectly valid MutableList.</li>
  <li>Ignore the issue; the initial capacity never actually makes a measurable difference to speed.</li>
  <li>Something else?</li>
  </ol>