I think it\'s a fairly simple question, but I can\'t figure out how to do this properly.
I\'ve got an empty arraylist:
ArrayList list =
How about this little while loop as a solution?
while
private ArrayList list = new ArrayList(); private void addObject(int i, Object object) { while(list.size() < i) { list.add(list.size(), null); } list.add(i, object); } .... addObject(1, object1) addObject(3, object3) addObject(2, object2)