title: Looping with iterator vs temp object gives different result graphically (Libgdx/Java)
body: <p>I've got a particle "engine" whom I've implementing a Pool system to and I've tested two different ways of rendering every Particle in a list. Please note that the Pooling really doesn't have anything with the problem to do. I just followed a tutorial and tried to use the second method when I noticed that they behaved differently.</p>
  
  <p>The first way:</p>
  
  <pre><code>            for (int i = 0; i &lt; particleList.size(); i++) {
              Iterator&lt;Particle&gt; it = particleList.iterator();
              while (it.hasNext()) {
                  Particle p = it.next();
                  if (p.isDead()){
                      it.remove();
                  }
  
                  p.render(batch, delta);
              }
          }
  </code></pre>
  
  <p>Which works just fine. My particles are sharp and they move with the correct speed.</p>
  
  <p>The second way:</p>
  
  <pre><code>            Particle p;
          for (int i = 0; i &lt; particleList.size(); i++) {
              p = particleList.get(i);
              p.render(batch, delta);
  
              if (p.isDead()) {
                  particleList.remove(i);
                  bulletPool.free(p);
              }
  
          }
  </code></pre>
  
  <p>Which makes all my particles blurry and moving really slow!</p>
  
  <p>The render method for my particles look like this:</p>
  
  <pre><code>    public void render(SpriteBatch batch, float delta) {
      sprite.setX(sprite.getX() + (dx * speed) * delta * Assets.FPS);
      sprite.setY(sprite.getY() + (dy * speed) * delta * Assets.FPS);
      ttl--;
      sprite.setScale(sprite.getScaleX() - 0.002f);
  
      if (ttl &lt;= 0 || sprite.getScaleX() &lt;= 0)
          isDead = true;
  
      sprite.draw(batch);
  }
  </code></pre>
  
  <p>Why do the different rendering methods provide different results?</p>
  
  <p>Thanks in advance</p>