You need to sign in to do that
Don't have an account?

error explanation
i am get the following error
System.ListException: List index out of bounds: 0
public List<List<DataEntrySummaryBean>> getPresentFutureValueList { get { Integer listSize = summaryBeanIndexList.get(0).get(0).fieldList.size(), indexStart; for(List<DataEntrySummaryBean> summaryBeanList : summaryBeanIndexList) { for(DataEntrySummaryBean summaryBean : summaryBeanList) { indexStart = summaryBean.fieldList.size(); if(indexStart < listSize) { for(Integer index = indexStart; index < listSize;index+=2) { summaryBean.fieldList.add(0,0); } } } } return summaryBeanIndexList; } }
Lets suppose I have done this in my apex :
This will give me error "ListException: List index out of bounds: 0" as there is no record retrieved from query and am using the record Id. If the query is returning some value in any case then this error will not come.
Now there are many ways to resolve this one of them is listed below
Please provide your code here if your problem is not resolved by this.
And if the problem gets resolved then mark it as solution :)
Thanks
Ankit Arora
Blog | Facebook | Blog Page
thanks ankit i have edited my code so can u help me an find out what should in do
Please highlight the line where you are facing error, and if possible send the code which is calling this method.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
I guess the problem is here :
If you are using "index" to get value from list then make sure it is not exceeding the total size of the list. Like this :
Hope this will help.
Thanks
Ankit Arora
Blog | Facebook | Blog Page