0

I have a problem that I think simple but I can't resolve it :D

I have a List and I want to get for exemple the second value of the second Object of this List. But, How can I do that ??

This is an example of the List display into the browser :

[[248,6,"Expired"],[123,2,"In Progress"]]

And my code :

List<Object[]> myList = ......; // myList contains the two objects display above.

For example, I want to get ( for do tests on this ) the second value of the second object in my example, so in this example : '2';

Thanks for your help

Fizik26
  • 753
  • 2
  • 10
  • 25

2 Answers2

6
myList.get(1)[1]

myList.get(1) give you the second array in the list and [1] give you the second object in that array.

Ricola
  • 2,621
  • 12
  • 22
0

You can use below format:

(myList.get(<index of object>))[<index of element in object array>]

In your case, both of these indices will be 1.

(myList.get(1))[1]
Tejas Jagtap
  • 11
  • 1
  • 3
  • This answer is not adding any extra information as already given with the answer of Ricola –  Jan 04 '19 at 09:11
  • That is true. We seem to answered it same time approximately. At the time I started answering this, the mentioned answer was not there. – Tejas Jagtap Jan 04 '19 at 10:26