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 =
You can use Array of objects and convert it to ArrayList-
Object[] array= new Object[10]; array[0]="1"; array[3]= "3"; array[2]="2"; array[7]="7"; List list= Arrays.asList(array);
ArrayList will be- [1, null, 2, 3, null, null, null, 7, null, null]