0

For example is this

for (String s : getStrings()) {
    // do something
}

less efficient than this?

ArrayList<String> strings = getStrings();
for (String s : strings) {
    // do something
}

Would getStrings() get called every time, thus affecting performance?

secondbreakfast
  • 3,802
  • 4
  • 35
  • 87

0 Answers0