How is Java's for loop code generated by the compiler?
For example, if I have:
for(String s : getStringArray() )
{
//do something with s
}
where getStringArray() is a function that returns the Array I want to loop on, would function be called always or only once? How optimal is the code for looping using this construct in general?