loop not iterating through entire arraylist
<p>I'm having a problem where I am trying to iterate through an arraylist which stores restaurant objects but the loop only goes through 3 of the five elements.</p>

<p>I created a test method to illustrate:</p>

<pre><code>public void testLoop() {
        ArrayList&lt;Eatery&gt; test = new ArrayList&lt;Eatery&gt;();
        test = eateriesListDefault;
        for(Eatery e : test) {
            MyLog.e(TAG, "Name: " + e.getName());
        }
        for (int i = 0; i &lt; eateriesListDefault.size(); i++) {
            MyLog.e(TAG, "Name " + test.get(i).getName());
            test.remove(i);
        }
        for(Eatery e : test) {
            MyLog.e(TAG, "Name " + e.getName());
        }
    }
</code></pre>

<p>Here test will have 5 eatery objects in it. The first loop succesfully prints 5 of 5 names.
The second loop only removes 3 of the eateries and therefore the last loop prints two names.</p>

<p>I have tried using </p>

<pre><code>for(Eatery e : eateriesListDefault) {
            MyLog.e(TAG, "Name: " + e.getName());
            test.remove(e);
}
</code></pre>

<p>in place of the second loop, however I get a concurrent access error.</p>

<p>Does anyone know what I am doing wrong?</p>
