+ Start a Discussion

how to pass two values for a key in map without overwriting

hi i have two queries for two non relational objects . they have same fields date for both 


now in my map i want to put a key when retrieved should get the records from both the objects that are having the same date




It is not possible in map because 1 key contains multiple unique values.


If you want to store duplicate values then you can use List with the map.


For example


Map<integer, list<string>>  ss=new Map< integer ,list<string>>  ();

List<string> s1=new list<string>(){‘a’,’b’,’c’,’a’,’b’};



for more detail follow below link:



Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.