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
roni shoreroni shore 

Fetch value from nested list

Hi Guys,
can anyone pls suggest how to get a certain value from nested list<map's>
 List<Map<String,Object>> newl =  new List<Map<String,Object>>();
                         for(Object itrObj : l){
                             newl.add((Map<String, Object>)itrObj); // got all records here
//how to get certain values from the collection
                             system.debug('id val==>'+ newl);
Greg HGreg H
Your question is a bit vague. Based upon your snippet alone I am not sure what benefit you have by creating a list of map. Why not just use the map. Anyway, you can call a specific element in the list directly using the get method on the list and then you can use a key from the map to get a specific element from the map. Or you can iterate over the list and then check if a key is present in the map by using the containsKey method on the map.