What is the best data structure, in java, for getting and setting items by index?
I was initially using ArrayList, but the problem is sometimes, I need to insert an element that is greater than the size of arraylist, like:
pseudocode
array = new ArrayList();
array.set(10, object);
Obviously this returns out an error. I could initialize the array with sentinel values, but using:
array.size()
will always say that my array is filled to the brim. Obviously it is just filled with sentinel values.