It would be Simpler to say - there is no way to make an existing array larger.
You can copy its contents to another larger array.
Type: Posts; User: Norm
It would be Simpler to say - there is no way to make an existing array larger.
You can copy its contents to another larger array.
It looks like arraycopy() saves you writing a loop. I don't see where it adds any elements to an existing array.
What method is that? I see a method that will copy array elements but none that will change the size of an existing array.
Depends what you mean by add. What if the element at that index was null?
Arrays always have some value in all the slots. Initially they are null for arrays of objects.
That would put the object at the last element in the array.
Try it and see what happens.
theArray[theIndexToEnd] = anObject; // add an object to the end
You need the index of where you want to add the object and then use it with the array.