I need to store it in a map with List as child and Id as parent
For an example my data spit something like this just to give you an idea:
DEBUG|//PId : 500o0000008V0alBAC
DEBUG|//Child: CaseNumber: 12345A Status: Not Started
DEBUG|//PId : 500o0000008V0alBAC
DEBUG|//Child: CaseNumber: 12345B Status: Not Started
DEBUG|//PId : 500o0000008V0alBAC
DEBUG|//Child: CaseNumber: 12345C Status: Not Started
DEBUG|//PId : 500o0000008V0alBAC
DEBUG|//Child: CaseNumber: 12345D Status: Not Started
//many more different Pid and Child ....
How can I store that in Map?, something like this?
Map<Id, List<Case>> parentChildCase = new map<Id, List<Case>>();
Here is my code that render the above debug code:
Map<id, id> pcids = new Map<id, id>();
//....
for(Case c :[/*SOQL*/]) {
if(pcids.containskey(c.ParentId) {
system.debug('//Pid: ' + parents.get(c.pareintid));
system.debug('Child: ' + c);
}
}