Free Salesforce Developers Tutorials >

Chapter 3 - Apex Datatypes and Operators >

Maps in APEX

Maps in APEX

What You’ll Learn


S2 Labs

What Is Maps In Apex?

130 131 132 133 134 135
‘Bhavya’ ‘Divya’ ‘Bhawna’ ‘Sapna’ ‘Pushpa’ ‘Harsha’
      1. Map is a collection of key, value pairs. Keys can be any primitive datatype while values can include primitives, apex objects, sObjects, and other collections.
    1. Use maps when want to quickly find out something with the help of a key, each key must be unique but you can have duplicate values in your map.
        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.

      Syntax Of Maps In Apex

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

      Example Of Maps In Apex

      // Nested map
      Map<ID, Set<String>> m = new Map<ID, Set<String>>();
      salesforce-developer

      Download Study Material

      Get access to exclusive study material for Salesforce Certification and ace your exams!

      Download Now

      Our Salesforce Certification Courses

      Hey there! Glad you made it through our Salesforce Developer Training for beginners . But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

      Post a Comment

      Your email address will not be published. Required fields are marked *