You need to sign in to do that
Don't have an account?
Syed F Raza 10
I am receiving error : System.ListException: List index out of bounds: 0
Hi All,
The following tag is executing as per requirement:
However if I use the list.add(index,element) method to add elements I am receivng error System.ListException: List index out of bounds: 0
The code I am having error with is
Thanks!!
The following tag is executing as per requirement:
List<integer> list1= new List<integer>(); list1.add(10); list1.add(20); list1.add(30); list1.add(40); system.debug('Value of List after increase is '+list1);
However if I use the list.add(index,element) method to add elements I am receivng error System.ListException: List index out of bounds: 0
The code I am having error with is
List<integer> list1= new List<integer>(); list1.add(0,10); list1.add(1,20); list1.add(2,30); list1.add(3,40); system.debug('Value of List after increase is '+list1);Please advise.
Thanks!!
In Apex we have the different syntax for this:
Refer the List Methods from below document:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_list.htm
Thanks,
Maharajan.C