4
votes
Why can a Set be modified in an Apex loop but not a List?
In Iterating Collections, we are instructed:
Collections can consist of lists, sets, or maps. Modifying a collection's elements while iterating through that collection is not supported and causes an ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
iteration × 112apex × 37
lightning-aura-components × 29
lightning-web-components × 23
aura × 14
batch × 13
lightning × 9
list × 9
loop × 9
map × 8
javascript × 7
visualforce × 6
aura-iteration × 6
collection × 5
soql × 4
css × 3
sobject × 3
wrapper-class × 3
table × 3
template × 3
visual-workflow × 2
controller × 2
class × 2
picklist × 2
lightning-apps × 2