Home SALESFORCEAPEX Iterating Map using for loop in Apex Class

You can user keyset() method to iterate over keys in map to fetch values
Apex Class:
[JAVA]
Map fieldList = new Map{‘Name__c’=>’Name’, ‘Age__C’=>’Age’};
for (String fieldName : fieldList.keySet()){
system.debug(fieldName);
}
[/JAVA]

You may also like