I have this ArrayList
[21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36]
created this way
for (int i = 0; i < number; i++) {
ArrayList.add(21+i);
}
In my code I have to remove, and sometimes return, some values from that without changing the position of the others. I tried with
ArrayList.add(removedValue, null);
so I had something like this
ArrayList = [21, 22, 23, null, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36]
but in this way I cannot Sort the Array with Collections.
Is there something else that I can do to fix that, without destroying my array?