Originally Posted by
ile4
Thank you for all your help so far, I have written the code. It is now creating a new array each time a new element needs to be added, so it starts off with length 0, then i add a new element and the size is 1, but when i add a second element the size is 2, the second element is in space 2 (well 1) but the first element is gone. So it the code is working how I want it to but in my newArray() method I need to clone the array and I cant figure out how I would do this.
I thought of storing all the elements in a field and then copying them over but the only field that can store multiple values is an array...! So how can I copy the current elements of an array over to a new array?