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
  • 4,194
  • 5
  • 47
  • 101

0 Answers0