+ Start a Discussion

How can i make 2 dimensional array in apex. Lists or Maps are not suitable for my purpose



i want to make a two dimesional array in apex.  Lists or Maps are not suitable for my purpose. How can I do that?



Why is a list/map of lists not suitable? Can we get some details as to what it is you're trying to do?

I'm assuing you want to have 2 values attached to the same key?


Why not create two maps? When you loop through your records add Value A to Map A and Value B to Map B, using the same key. This way when you need to return the values you can use the get property on Map A and Map B for the same key and get both values


how about Map of Map:


Map<Id, Map<String, Contact>>