So let say I have an array of size 10 with index range from 0 to 9. I add a bunch of elements in and stop adding at index 6. So with array.length, I can know that the size of the array is 10, but how do I find which index contain the last value and after that is empty? Am I suppose to do a loop and stop at index == null?
I mimic an arraylist by create a dynamic array that grow when the size is full.
Arg, forgot to tell you guys, if the array is int, then the empty slots will be 0?
ArrayListinsteadArrayList