It looks like no matter what size you personally make it, you are trying to add (or rather INSERT) at the next largest (and NON-EXISTENT) integer, hence the error.
add(int index, Object element)
Inserts the specified element at the specified position in this list.
IndexOutOfBoundsException - if index is out of range (index < 0 || index > size()).
So if size()==10, it would not have an element # 10. It would be elements 0 to 9.
Try
add(Object o)
Appends the specified element to the end of this list.
And see if that works for you. This adds to the end of the list and seems to be what you want anyway. Otherwise, watch out for the index you are trying to use.
Grr Grr, Let's make it 1000 elements and add to location 1002. Grr
I feel your pain buddy! BTW, your subject title had me rolling on the floor. Now I have a pain in my side.![]()




Reply With Quote