title: How to keep List index fixed in Java
body: <p>I want to keep the indices of the items in a Java List fixed.</p>
  
  <p>Example code:</p>
  
  <pre><code>import java.util.ArrayList;
  public class Test {
      public static void main(String[] args) {
          ArrayList&lt;Double&gt; a = new ArrayList&lt;Double&gt;();
          a.add(12.3);
          a.add(15.3);
          a.add(17.3);
  
          a.remove(1);
          System.out.println(a.get(1));
      }
  }
  </code></pre>
  
  <p>This will output <code>17.3</code>. The problem is that <code>17.3</code> was on index 2 and now it's on index 1!</p>
  
  <p>Is there any way to preserve the indices of other elements when removing an element? Or is there another class more suitable for this purpose?</p>
  
  <p>Note: I don't want a fixed size Collection.</p>