-2

I have below snapshot where i just wanted to check if map is having the value 20 in it or not. How i can write if condition for list of string values

map<string,List<string>> getmap=new map<string,list<string>>();
                list<string> getList = new list<string>();
  • please explain a bit more about your problem. do you want to find 20 in the key or in the list, Whether 20 can be contained inside an String or a String value has to be compared to be equal to 20. – mritzi Jan 28 at 12:01
1

You can iterate the map and check the list to search like this:

for (String key: getmap.keySet()) {
    if (getmap.get(key).contains('20')) {
        //20 found, do something
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.