methods in foreach and for loops in java
<p>My question is regarding optimization in java using the Android compiler.  Will map.values() in the following be called every iteration, or will the Android compiler optimize it out.</p>

<pre><code>LinkedHashMap&lt;String, Object&gt; map;

for (Object object : map.values())
{
   //do something with object
}
</code></pre>

<p>Likewise here is another example.  will aList.size() be called every iteration?</p>

<pre><code>List&lt;Object&gt; aList;

for (int i = 0; i &lt; aList.size(); i++)
{
    object = aList.get(i);
    //do something with i
}
</code></pre>

<p>And after all this, does it really matter if it calls the methods every iteration?  Does Map.values(), and List.size() do much of anything?</p>
