+ Start a Discussion

how to build map<String, list<list<string>>>

how to build map<String, list<list<string>>>..

Thank you.
It might be helpful to know exactly what you are trying to do with this structure in order to show you the best way to build it for your purposes. That said, here is a simple way of doing it:

List<String> innerList1 = new List<String>{'string1', 'string2', 'string3'};
List<String> innerList2 = new List<String>{'string4', 'string5', 'string6'};
List<List<String>> outerList1 = new List<List<String>>{innerList1, innerList2};

List<String> innerList3 = new List<String>{'string7', 'string8', 'string9'};
List<String> innerList4 = new List<String>{'string10', 'string11', 'string12'};
List<List<String>> outerList2 = new List<List<String>>{innerList3, innerList4};

Map<String, List<List<String>>> listMap = new Map<String, List<List<String>>>{
    'list1' => outerList1, 
    'list2' => outerList2