ForceTree.com: Collections in Apex: List, Maps and Sets

PHOTO EMBED

Fri May 21 2021 14:12:57 GMT+0000 (UTC)

Saved by @powercod35

Set<String> Accountids = new Set<String>();
for (Account a: [Select Id from Account limit 5])
    Accountids.add(a.Id);
system.debug('The size of the set is'+accountids.size());
for (Account a: [Select Id from Account limit 5])
    Accountids.add(a.Id);
system.debug('The size of the set is'+accountids.size());
content_copyCOPY

https://www.forcetree.com/2013/05/collections-in-apex-list-maps-and-sets.html