You need to sign in to do that
Don't have an account?

Hi developers how to get the keyset(); and values() form loop using the Map class
map<string,string> custmap = new map<string,stirng>();(declared and initialised in the constructor)
Example1:in Debug window the custmap values are :
{Andrapradesh=5.0, Karnataka=3.0, Maharastra=2.5, Telangana=4.0}
//How to print the keyset and values :
for(list<wrapper> s: custmap){
system.debug(s.keyset());
system.debug(s.Values());
}
//wrapperclass
public class wrapper{
public string statename;
public string rating;
}
Thanks
Deepika
Example1:in Debug window the custmap values are :
{Andrapradesh=5.0, Karnataka=3.0, Maharastra=2.5, Telangana=4.0}
//How to print the keyset and values :
for(list<wrapper> s: custmap){
system.debug(s.keyset());
system.debug(s.Values());
}
//wrapperclass
public class wrapper{
public string statename;
public string rating;
}
Thanks
Deepika
Keys and values can be any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types. You can iterate these and print/get key/values. Here is a snippet form documentations -