You need to sign in to do that
Don't have an account?
vijendhar k 16
List<List<list<Integer>>> my_list_2 = new List<List<list<Integer>>>();
Hi All,
when to use nested list in salesforce
can you please help understnd following list, adding data, iterating data for the follwing example
List<List<list<Integer>>> my_list_2 = new List<List<list<Integer>>>();
explain me to nexted complete playing with any example please
when to use nested list in salesforce
can you please help understnd following list, adding data, iterating data for the follwing example
List<List<list<Integer>>> my_list_2 = new List<List<list<Integer>>>();
explain me to nexted complete playing with any example please
does that help?
All Answers
does that help?
Thanks for Quick &Great response, i understand how to loop list with 3 level nested list with your example, if posible can you please give us example with adding data and looping data with sobjects in salesforce, your work will be appreciable to improve my Devlopment knowledge
Thanks
Vijay :)
Let's move the example from integer's to - strings. Let's say that you want to hold a List<list<list<string>>> that represents Countries, States, Cities. Say your data looks like this... (and it would make more sense to use Maps in this case - but I'll stay with list<string>)
USA
AK
ACityName
BCityName
AL
ADifferentCityName
BDifferentCityName
I think that code would work - but I didn't test it.
Is that what you were looking for? You might need to tell us more of what you're doing or trying to do.
Thanks for reply, with that code i can only add citys, but if i want to add the list mentions like country==>state-->city into the list, how to write code as per your code i can see following output http://tinypic.com/r/hth4t1/9
public static void testingMap(){
Map<string,list<string>> map1= new Map<string,list<string>>();
list<string> list1= new list<string>();
list1.add('Hyderabad');
list1.add('Secendrabad');
map1.put('Telengana', list1);
Map<string,list<string>> map2= new Map<string,list<string>>();
list<string> list2= new list<string>();
list2.add('City1');
list2.add('City2');
map2.put('NewYork', list2);
Map<string,list<string>> map3= new Map<string,list<string>>();
list<string> list3= new list<string>();
list3.add('Seoul');
list3.add('South');
map3.put('North_korea', list3);
Map<string,Map<string,list<string>>> countryStateCity= new Map<string,Map<string,list<string>>>();
countryStateCity.put('India',map1);
countryStateCity.put('Us',map2);
countryStateCity.put('North_korea',map3);
System.debug(countryStateCity.get('India'));
System.debug(countryStateCity.get('Us'));
System.debug(countryStateCity.get('North_korea'));
}
}