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
Karthik jKarthik j 

Hey i want get key of particular value in map. How i can achieve this?

CharuDuttCharuDutt
Hii Karthik 
Try Below Code
map<String,String> maps = new map<String,String>();
maps.put('A','a');
maps.put('B','b');
maps.put('C','c');
for(String key : Maps.keySet()){
  if(Maps.get(key) == 'b'){
    system.debug(key);
  }
}
Please Mark It As Best Answer If It Helps
Thank You!

 
Suraj Tripathi 47Suraj Tripathi 47
Hi,

Please follow the below link:-
map<Integer,String> testMap = new map<Integer,String>();
testMap.put(1,'red');
testMap.put(2,'orange');
testMap.put(3,'Blue');
for(String key : testMap.keySet()){
  if(testMap.get(key) == 'orange'){
    system.debug('true-- '+key);
  }
}


Please mark it as Best Answer if it helps you.

Thanks & Regards
Suraj Tripathi
Suzanne ShanksSuzanne Shanks
Know how to cancel Norton subscription and claim a refund back. You need to log in to your account and find the subscription tab and turn off it. also, here you can make a request for a refund back before the end of your plan.