+ Start a Discussion
vijendhar k 16vijendhar k 16 

expecting right curly bracket, found '{'

Hi all,
List<List<Integer>> listOfListInt = new List<Integer> { {0, 1, 2, 3}, {3, 2, 1, 0}, {3, 5, 6, 1}, {3, 8, 3, 4} };  After executeig the code in developer console i am getting follwing error
Line: 1, Column: 56
expecting right curly bracket, found '{'
Please help me fix error
Thanks

 
Omveer kundu 8Omveer kundu 8
Hi Try This
List<List<Integer>> listOfListInt = new List<List<Integer>>{new List<Integer>{0'1,2,3},new List<Integer>{3,2,1,0},new List<Integer>{3,5,6,1}};
JeffreyStevensJeffreyStevens
List<List<Integer>> listOfListInt = new List<List<Integer>>{new List<Integer>{0,1,2,3},new List<Integer>{3,2,1,0},new List<Integer>{3,5,6,1}};
    system.debug('listOfListInt='+ListOfListInt);

Omveer had an extra ' in the first list.  vjendhar had the instansatation wrong (after the = sign)  - should have been = new list<list<integer>> ..
Ansh CoderAnsh Coder
Hi,
use this format
List<List<integer>> names = new List<List<integer>>
{
    new List<integer>{1, 1, 9},
    new List<integer>{1, 2, 0},
    new List<integer>{1, 3, 6},
    new List<integer>{1, 4, 5, 2}
};

 
Omveer kundu 8Omveer kundu 8
Yeah By Mistake
pls try this
List<List<Integer>> listOfListInt = new List<List<Integer>>{new List<Integer>{0,1,2,3},new List<Integer>{3,2,1,0},new List<Integer>{3,5,6,1}};

 
vijendhar k 16vijendhar k 16
Thanks to all for reply , your work is appreciable  , it helped me lot :)