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
Conner Kinsner 10Conner Kinsner 10 

Best way to convert List<List<Opportunity>> to List<Opportunity>

i'm retrieving a List<List<Opportunity>> from a map.getValues() where the map definition is Map<String, List<Opportunity>>

I need this in a flat List. As of now, I wrote custom function to do so. But i feel like there's a better way or an out of the box solution to handle this
 
public List<Opportunity> covertListListToList(List<List<Opportunity>> lstlst) {
        List<Opportunity> lstMappings = new List<Opportunity>();

        for (List<Opportunity> opps : lstlst) {
            for (Opportunity rec : opps) {
                lstMappings.add(rec);
            }
        }
        return lstMappings;
}

 
Jessica smartJessica smart
Great thanks for the information.. 

https://www.krowd-darden.com/