You need to sign in to do that
Don't have an account?
Anjaneylu
One-Dimensional Lists and Two Dimensional lists
what is the difference between the One-Dimensional Lists and Two Dimensional lists .
if possible give one simple example..
Thanking you in advance..
if possible give one simple example..
Thanking you in advance..
Example - List<Integer> listint = new List<Integer>{0, 1, 2, 3 };
You could access item like
Integer i = listint.get(0); // which returns integer from 0th index
here i will be 0
One-Dimensional Lists - Is when items in the list are linear and you could access them with more then one index.
Example - List<List<Integer>> listOdListInt = new List<Integer> { {0, 1, 2, 3}, {3, 2, 1, 0}, {3, 5, 6, 1}, {3, 8, 3, 4} };
Integer i = listint.get(1).get(0); // which returns integer from 0th index of 1st index list
here i will be 3
i can' t understand the second example
integer i= listint.get(1).get(0);
here i will be 3 are you telling but how can explain
List<List<Integer>> listOfListInt = new List<Integer> { {0, 1, 2, 3}, {3, 2, 1, 0}, {3, 5, 6, 1}, {3, 8, 3, 4} };
Read this in two statements
List<Integer> listint = listOfListInt.get(1); // this will give {3, 2, 1, 0}
Integer i= listint.get(0); // this will give 3
so this could be written in one statement as
Integer i= listOfListInt.get(1).get(0);
Please mark this as answer so others could be helped form it.
i will understand.