130131132133134135
‘Bhavya’‘Divya’‘Bhawna’‘Sapna’‘Pushpa’‘Harsha’
  1. Map is collection of key, value pairs. Keys can be any primitive datatype while values can include primitives, apex objects, sObjects and other collections.
  2. Use maps when want to quickly find out something with help of a key, each key must be unique but you can have duplicate values in your map.
  3. Syntax for declaration:

Map<Datatype_Key, Datatype_value> m = new Map<Datatype_Key, Datatype_value>();

  1. To create a map of all the account records in your org, the Salesforce ID should be the key, which is the unique identifier for all the values of the account record.

Ex: // Nested map

Map<ID, Set<String>> m = new Map<ID, Set<String>>();

Our Recent Blog

Share This Post