Activity Forums Salesforce® Discussions What is the significance of keyset() method of MAP in Salesforce?

  • What is the significance of keyset() method of MAP in Salesforce?

  • shradha jain

    Member
    August 3, 2018 at 12:34 pm

    What is the significance of keyset() method of MAP in Salesforce?

  • Prachi

    Member
    August 8, 2018 at 6:30 am

    Hello shradha,

    keyset() Returns a set that contains all of the keys in the map.

    example:-

    Map<String, String> colorCodes = new Map<String, String>();

    colorCodes.put('Red', 'FF0000');
    colorCodes.put('Blue', '0000A0');

    Set <String> colorSet = new Set<String>();
    colorSet = colorCodes.keySet();

    The above example will return the list of the keys i.e red and blue.

    thanks.

  • shariq

    Member
    September 18, 2018 at 10:45 pm

    Hi,

    It returns you set of keys in map.

    Hope this helps.

  • Shweta

    Member
    January 28, 2020 at 1:33 pm

    keyset() method : It is a method used on map that returns a set that contains all of the keys present in the map.

  • Pooja

    Member
    January 28, 2020 at 2:31 pm

    In Salesforce, keyset() Returns a set that contains all of the keys in the map.

  • Kirandeep

    Member
    January 28, 2020 at 2:33 pm

    keyset()  is a predefined method in map class that returns a set that contains all of the keys in the map.

  • Shubham

    Member
    January 28, 2020 at 2:45 pm

    Hi Shradha,

    keyset() method returns a set of all the keys in a map

  • Marziya

    Member
    January 28, 2020 at 2:47 pm

    Hii Shradha,

    keySet() Returns a set that contains all of the keys in the map. put(key, value): Associates the specified value with the specified key in the map. putAll(fromMap) Copies all of the mappings from the specified map to the original map.

  • Purviek

    Member
    November 14, 2021 at 7:01 am

    Can anyone please help ??

    How to get specific key by passing value in map?

  • Patrick Avitan Drahi

    Member
    November 15, 2021 at 4:15 pm

    In the field there is the following formula which checks the values in the picklist and text fields and returns 1 or 0 respectively:if ((Picklist__c = "Call Later" && CB__C = False), 1.0)What is wrong with this formula?

Viewing 1 - 10 of 10 posts

Log In to reply.

Popular Salesforce Blogs