title: Java ArrayList.remove() isn't working?
body: <p>I have a quiz program but a small section is not working. Basically, I have an <code>ArrayList&lt;Object&gt;</code> that holds 10 (or more, doesnt matter) Question Objects that I can refer to later.</p>
  
  <p>Anyway, when I want to use <code>ArrayList.remove(index)</code>, it doesn't remove that object! I honestly do not know what to do.</p>
  
  <p>(Key Search is another class that takes in a string (key) and searches the quiz arraylist for it. It returns an arraylist of the questions that DO NOT contain the key word, thus letting me remove them from the overall question array.)</p>
  
  <pre><code>        ArrayList&lt;Integer&gt; indexAt = new ArrayList();
          indexAt = keyWord.indexAt(); //returning the questions that need to be removed
          System.out.println("(1) Number of Questions: " + Questions.size()); //debugging
          for(int i = 0; i &lt; indexAt.size(); i++)
          {
  
              Questions.remove(indexAt.get(i));
  
          }
  
          //prints out the questions that were removed (for my own reasoning)
          for(int i = 0; i &lt; indexAt.size(); i++)
          {
  
              System.out.println(indexAt.get(i));
          }
  
          System.out.println("(2) Number of Questions: " + Questions.size()); //debugging
  
          Sorting sort = new Sorting(Questions);
  </code></pre>
  
  <p>The output looks like this:</p>
  
  <hr>
  
  <p>(1) Number of Questions: 10</p>
  
  <p>1</p>
  
  <p>2</p>
  
  <p>3</p>
  
  <p>4</p>
  
  <p>6</p>
  
  <p>(2) Number of Questions: 10</p>
  
  <hr>
  
  <p>It should've removed indexes 1,2,3,4,6!!</p>