Collections In Salesforce | Apex Developer Guide
List
A rundown (likewise called a cluster) is a variable speaking to an arranged assortment of components that are distinguished by their lists. The record of a rundown is numeric and begins at 0 consistently.
This implies on the off chance that you have one thing in your rundown, at that point that thing's file is 0. On the off chance that you have two things, the main thing's record is 0, and the subsequent thing's list is 1. This will become more clear and less befuddling the more you use it. A rundown can be an assortment of any information type, crude, or something else. A rundown is proclaimed by determining the kind of component it gathers.
For instance, List<String> myListOfStrings could be utilized to speak to an assortment of strings. In this way, so as to announce a rundown variable, you would type list, trailed by the sort gathered inside < >. So as to recover the estimation of a component at file 0, you can do String recovered = myListOfStrings[0];
You can likewise rapidly startup (pronounce and characterize) a rundown to be an assortment of results from an inquiry.
For instance, on the off chance that you needed to have a rundown of your Account records, you could accomplish something like
List<Account> myAccountList = [select ID, name from Account]; to make a rundown containing an unfiltered rundown of your records with the ID and name fields accessible.
Don't forget to check out: Salesforce Apex Trigger Handler | The Developer Guide
Set
Sets are like records in that they are assortments of components. Be that as it may, they are unordered (you can't get to their qualities by record), and are unique since they can't contain copies. On the off chance that you endeavor to increase the value of a set twice, there will at present just be one component in the set with that esteem. This makes sets perfect for maintaing an assortment of extraordinary components, for example, IDs or messages, while working with enormous informational indexes. A set is proclaimed a similar way a rundown is, aside from the set catchphrase is utilized rather than list, as so:
set<String> mySetOfStrings.
Note A set is an assortment of unordered components, and you can't utilize a file to recover a component like you can with a rundown. Additionally, while repeating through the components in a set, you ought not to depend on the request being the equivalent.
Map
Map are what are known as "key/esteem" sets. They are assortments that record their qualities utilizing a particular key. So where records are requested in the request they are worked, with the primary component being at file 0, the second at list 1, etc, maps are ordered by a key you indicate.
Both the keys and qualities in a guide can be any information type, which means they can be crude, composites, assortments, and client characterized.
Check out another amazing blog by Sumit here: Getting Started with Salesforce Lightning Components and Record Pages
For instance, in the event that you had a guide that had a String type as both the key and worth, you could add a component to the assortment with key "firstName" and estimation of "Mike". At that point, when you needed to recover the estimation of "firstName", you would utilize "firstName" as the record. Guides are announced by utilizing the watchword map followed by the kind of key and the sort of significant worth, as map<key,value>.
To proclaim our guide containing the main name esteem, we would then utilize
map<String,String> myStringMap.
Likewise, with records, you can utilize a brisk explanation to launch a guide to the aftereffects of a SOQL question, which would plan a record to its comparing ID.
Thank you so much for the blog posts. I’m really loving it!