You need to sign in to do that
Don't have an account?
softcloud2009
For Loop using List<>
Hi All,
I would like to understand why For loop with List<> is more efficient than regular loop:
for (List<Account> accts : [query statement]
is more efficient than
for (Account accts : [query statement]
Can anyone help me to understand why??
Thanks.
I think the biggest efficiency is if you are doing DML within the for loop. You can maintain a List of objects, work over them, and do an upsert en masse.
Based on this documentation, it sounds like they are otherwise the same...