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 !

1 Answer 1


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, 2018 at 9:40
  • Yes. the way you are already doing. Nov 2, 2018 at 9:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .