You need to sign in to do that
Don't have an account?
King Kon
Get Nested Map Values
Hi can anyone help,
I have created a map which represents the following
map<Id, Map<Id, SObject> myMap = new map<Id, Map<Id, SObject>();
I have populate the different keys and values but I'm having problems retrieving the values in the SObject without having to loop through the map.
Something like myMap.values().values()
I know I can use mymap.get().get() so there must be some sort of shortcut
I have created a map which represents the following
map<Id, Map<Id, SObject> myMap = new map<Id, Map<Id, SObject>();
I have populate the different keys and values but I'm having problems retrieving the values in the SObject without having to loop through the map.
Something like myMap.values().values()
I know I can use mymap.get().get() so there must be some sort of shortcut
myMap.values() would return a list of map<Id,SObject>(); List has no method values() so it would fail if you tried to call values again.
myMap.get(ID).get(ID) would return an SObject.
myMap.get(ID).values() would return a list of SObjects
I don't believe there to be any other shortcuts to help you get around looping unless you have another way to get the keys.