title: Why is my ArrayList.remove(id) call not working?
body: <p>I have an ArrayList, which includes a number of items I want to remove.  I have the ids of the items to remove stored in another list.  Figured the following code should work trivially, but for some reason, the remove() calls are returning a false value:</p>
  
  <pre><code>  ArrayList&lt;Integer&gt; toRemove = new ArrayList&lt;Integer&gt;();
    ArrayList&lt;JCheckBox&gt; al = new ArrayList&lt;JCheckBox&gt;();
  
    /* Code that adds a bunch of items to al, and a few integers to toRemove */
  
    System.out.println("Size before removing: " + al.size());
    for (int i = toRemove.size() - 1; i &gt;= 0; i--) {
      System.out.println("Removing id: " + toRemove.get(i) + ": ");
      System.out.println(al.get(toRemove.get(i)));
      System.out.println(al.remove(toRemove.get(i)));
    }
    System.out.println("Size after removing: " + al.size());
  </code></pre>
  
  <p>I'd get it if the get() call also returned a false value, but it does actually return the object in question.  What am I missing here?</p>
  
  <p>The output of the code above:</p>
  
  <pre><code>Size before removing: 3
  Removing id: 2: 
  javax.swing.JCheckBox[...]
  false
  Size after removing: 3
  </code></pre>