Activity › Forums › Salesforce® Discussions › What is the use of size() in map in Salesforce? Salesforce® Discussions What is the use of size() in map in Salesforce? Posted by Pooja on February 21, 2020 at 2:34 PM What is the use of size() in map in Salesforce? Aditya replied 2 years, 10 months ago 4 Members · 3 Replies 3 Replies Deepak Member February 21, 2020 at 2:52 PM Hi Pooja, size() Returns the number of key-value pairs in the map. [adinserter block='9'] Kirandeep Member February 21, 2020 at 3:13 PM Hi Pooja, size() is a pre defined function in map class which returns the number of key-value pairs in the map. Aditya Member February 21, 2020 at 4:26 PM A map is a collection of key-value pairs where each unique key maps to a single value. In map Keys can be any primitive data type like string, integer,decimal, Id while values can be a primitive, sObject, collection type or an Apex object Log In to reply. Public All Members My Connections Only Me PublicAll MembersMy ConnectionsOnly Me Public All Members My Connections Only Me