title: Removing object from ArrayList in for each loop
body: <p>I would like to remove an object from an <code>ArrayList</code> when I'm done with it, but I can't find way to do it. Trying to remove it like in the sample code below doesn't want to work. How could I get to the iterator of current <code>px</code> object in this loop to remove it?    </p>
  
  <pre><code>for( Pixel px : pixel){ 
  [...]
    if(px.y &gt; gHeigh){
       pixel.remove(pixel.indexOf(px)); // here is the thing
       pixel.remove(px); //doesn't work either
    }
  }
  </code></pre>