title: Java holding 3 values in array
body: <p>I need a array object, that should holds 3 Objects.</p>
  
  <p>At first was using <code>Collection</code>, but I need to add to a specific place. for example:</p>
  
  <pre><code>CollectionObject.add(pos, myObject)
  </code></pre>
  
  <p>Then I went to <code>ArrayList</code>, created object like this:</p>
  
  <pre><code>ArrayList&lt;MyObject&gt; array = new ArrayList&lt;MyObject&gt;();
  </code></pre>
  
  <p>When creating this, it creats array with size 1, but I need to add to position 0-2, so adding like:</p>
  
  <pre><code>array.add(2, myObject)
  </code></pre>
  
  <p>I got :</p>
  
  <pre><code> java.lang.IndexOutOfBoundsException: Index: 2, Size: 1
  </code></pre>
  
  <p>My solution is, create arraylist, add 3 empty objects to it, and later overwrite, but any more subtle solution? Are there any better array holding objects, like <code>Vector</code> or something?</p>