I have a map map like that and I wanted to know if I could get all the occurrences of my key in one and the same list (without making a loop).

Would you be able to do that?

public static void setRepartition(Set<ID> idOpps){

     Map<ID, Map<ID, OpportunityTeamMember>> wrapper = new Map<ID, Map<ID, OpportunityTeamMember>>();
     Map<ID, OpportunityTeamMember> opportunitiesTeamMember = new Map<ID, OpportunityTeamMember>();

     for (ID oppID : idOpps){
          opportunitiesTeamMember =new Map<ID, OpportunityTeamMember>();
          opportunitiesTeamMember = wrapper.get(oppID);



Thanks !


As of now there is no method of map like map.getAll to get all values of map by passing keySet.

  • So I have to go through a loop to add as I go along ? – cpt_3n0x Nov 2 '18 at 9:40
  • Yes. the way you are already doing. – Radhe Radhe Nov 2 '18 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.