title: java arraylist ensureCapacity not working
body: <p>Either I'm doing this wrong or i'm not understanding how this method works.</p>
  
  <pre><code>ArrayList&lt;String&gt; a = new ArrayList&lt;String&gt;();
  a.ensureCapacity(200);
  a.add(190,"test");
  System.out.println(a.get(190).toString());
  </code></pre>
  
  <p>I would have thought that ensureCapacity would let me insert a record with an index up to that value. Is there a different way to do this?</p>
  
  <p>I get an IndexOutOfBounds error on the third line.</p>