Access elements of List <List <List <List <Object> >>> titles = new ArrayList <List <List <List <Object> >>> ();

willy22 :

I have the following list List <List <List <List <Object> >>> titles = new ArrayList <List <List <List <Object> >>> (); and I would like to access the elements of it but I don't know how to do that ..

The list has 1 element that in its turn contains 3 elements and each of those 3 elements contains 6 elements but I don't know how to access each of them.

This is the output of the arraylist when I put it in a listview:

 1 element---> [[[12,"01",1,"Fallo de corriente",0,1],
 2 element---> [12,"01",2,"Nivel m\u00E1ximo (activaci\u00F3n)",0,0],
 3 element--->   [12,"01",3,"Nivel m\u00E1ximo(desactivaci\u00F3n)",0,1]]]

Within each element I have 6 elements as you can see, how can I access element 1 that has 6 elements inside and access each of them?

dzenang :

If you really want to use that kind of structure, you can use something like this, e.g. to extract title of the first item.

String title1 = titles.get(0).get(0).get(0).get(3).toString();

So you have four levels of hierarchy, titles list is level 1 and get(0) will take the list it contains, get(0) will take first (and only item) of level 2, get(0) will take first out of 3 items of level 3, and finally get(3) will take fourth element of level 4 which is actual title as I can see.

So your title1 should be "Fallo de corriente"

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325823&siteId=1