The class you are using does not support that. It doesn't like empty slots.
If you use an array not an ArrayList, you can add items anywhere you want.
Type: Posts; User: Norm
The class you are using does not support that. It doesn't like empty slots.
If you use an array not an ArrayList, you can add items anywhere you want.
You need to read the API doc for the ArrayList's add method. It lists the exceptions that can be thrown and gives the reasons they are thrown. Your case is described there on the last line.