What's the best way to iterate over an array returned by a function?
Example:
for (String s : collectMyStrings()){
System.out.println(s);
}
Is collectMyStrings() called in each iteration, or does Java only call it once, and use the returned array for all iterations of the for loop?