Showing posts with label Iterating Map. Show all posts
Showing posts with label Iterating Map. Show all posts

Thursday, July 19, 2012

Iterating Map using for loop in Apex Class


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