• Conner Kinsner 10
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
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;
}