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
Ajay EdlaAjay Edla 

how to use containskey method in map in salesforce. and please explain meaning of if(!nummap.containsKey(num)), nummap is Map collection, , num is integer variable ( some integer values like 1,1,2,3,2,3)

please explain the meaning of  below condition.

if(!nummap.containsKey(num))

nummap is Map collection,
num is integer variable ( some integer values like 1,1,2,3,2,3)
JeffreyStevensJeffreyStevens
The ! in apex means NOT.  So that IF statement is checking that num is NOT in the keyset of nummap.
AnkaiahAnkaiah (Salesforce Developers) 
Hi Ajay,

As  Jeffrey said,
The ! in apex means NOT.  So that IF statement is checking that num is NOT in the keyset of nummap.

Refer the below help article related to collections.
https://developer.salesforce.com/docs/atlas.en-us.240.0.apexcode.meta/apexcode/langCon_apex_collections.htm

Thanks!!