function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ramesh babu 114ramesh babu 114 

what is the difference between list and map

what is the difference between list and map
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Ramesh,

Lists:: A list is an ordered collection of elements that are distinguished by their indices. List elements can be of any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types.

Maps
A map is a collection of key-value pairs where each unique key maps to a single value. Keys and values can be any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types.

Please refer the below link for reference. hope it helps.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar



 
raj_sfdccraj_sfdcc
Hi Ramesh,

List can hold more then sinlge record .you can use list to bulkify your code.

Map-Map can help you when you are dealing with parent-child executions .

Please find the below post which can give you clear idea about list and map with real time examples .
List Vs Map (https://salessforcehacks.blogspot.com/2020/01/collections-in-salesforce-list-set-map.html)