I know that I cannot store a value at an index of an ArrayList that hasn\'t been used yet, i.e. is less than the size. In other words, if myArrayList.size() is 5, then if I
If you definitely have to use the list and not a map, then it's best you override the arraylist's add and set methods to first put a null in indexes before. No other better way IMO