0

I am getting this error for List

List index out of Bound Exception:2060

Here my Total Size is 2063.

for(Integer j=total_size-Math.mod(total_size,list_size);j<total_size;j++)
{
   ListWrap.add(wraplist.get(j));
}
1
  • The implication is that you have a variable called total_size which is = 2063 but you are referring to a list which doesn't have that many members. Why use total_size instead of wraplist.size() ?
    – Doug B
    Oct 8, 2015 at 8:18

1 Answer 1

0

The implication is that you have a variable called total_size which is = 2063 but you are referring to a list which doesn't have that many members. So you are trying to retrieve a list entry which doesn't exist.

Perhaps your calculation of total_size is incorrect? Why not use wraplist.size()?

Try amending the code as follows, the output will be informative.

System.debug('total_size = ' + total_size);
System.debug('wraplist size = ' + wraplist.size());
for(Integer j=total_size-Math.mod(total_size,list_size);j<total_size;j++)
{
   ListWrap.add(wraplist.get(j));
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .