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));
}
  • 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 '15 at 8:18
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));
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.