function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mwicksmwicks 

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

Hi,

 

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

 

Thanks

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

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

AltiumForceAltiumForce

how about Map of Map:

 

Map<Id, Map<String, Contact>>