You need to sign in to do that
Don't have an account?
Nithesh N
Alternative to Nested Apex iterations ?
Its a well known fact that loops inside of loops, especially nested more than once, can be catastrophic for CPU performance.
I want to know the best practices to avoid the nested loop scenarios if possible.
Thanks !!
for(Integer a = 1; a <= 100; a++) { for(Integer b = 1; b <= 100; b++) { for(Integer c = 1; c <= 100; c++) { System.debug(a * b * c); } } }Is there any alternative algorithm to avoid nested loops?
I want to know the best practices to avoid the nested loop scenarios if possible.
Thanks !!
https://salesforce.stackexchange.com/questions/80387/avoid-nested-for-loop-while-iterating-mapinteger-setinteger
All Answers
The best practice is that to use Collection to avoid the Nested for loop and also using the Collection SOQL inside for loop can be avoid. If there is no way where we can minimise the Nested for loop then we need to use Nested For Loop.
Let me know the outcomes.
Thanks,
AMit Singh
https://salesforce.stackexchange.com/questions/80387/avoid-nested-for-loop-while-iterating-mapinteger-setinteger