Map of Id & List of An object for set Records of particular records.
Snippt of Code :
***********************************************************************
Map<Id, List < Temp__c > mapAccIdListTemp = new Map<Id, List<Temp__c>>();
List<Temp__c> listTemp = new List<Temp__c>();
for(Temp__c Temp : [SELECT Id, Account__c FROM Temp__c]){
if(mapAccIdListTemp.containsKey(Temp.Account__c)){
listTemp = mapAccIdListTemp.get(Temp.Account__c);
}
else {
listTemp = new List<Temp__c>();
}
listTemp.add(Temp);
mapAccIdListTemp.put(Temp.Account__c, listTemp);
}
***********************************************************************
No comments:
Post a Comment