title: Delete data from ArrayList with a For-loop
body: <p>I got a weird problem.
  I thought this would cost me few minutes, but I am struggling for few hours now...
  Here is what I got:</p>
  
  <pre><code>for (int i = 0; i &lt; size; i++){
      if (data.get(i).getCaption().contains("_Hardi")){
          data.remove(i);
      }
  }
  </code></pre>
  
  <p>The <code>data</code> is the <code>ArrayList.</code>
  In the ArrayList I got some strings (total 14 or so), and 9 of them, got the name _Hardi in it.</p>
  
  <p>And with the code above I want to remove them.
  If I <code>replace data.remove(i);</code> with a <code>System.out.println</code> then it prints out something 9 times, what is good, because _Hardi is in the ArrayList 9 times.</p>
  
  <p>But when I use <code>data.remove(i);</code> then it doesn't remove all 9, but only a few.
  I did some tests and I also saw this:</p>
  
  <p>When I rename the Strings to:
  Hardi1
  Hardi2
  Hardi3
  Hardi4
  Hardi5
  Hardi6</p>
  
  <p>Then it removes only the on-even numbers (1, 3, 5 and so on).
  He is skipping 1 all the time, but can't figure out why.</p>
  
  <p>How to fix this? Or maybe another way to remove them?</p>