Hi, I need help in creating a never ending array using java. It should basically work like and ArrayList but should be done using arrays.

make an "add" method that creates a new array of the origional length plus one and copy all the values over - with the extra one

:/

make an "add" method that creates a new array of the origional length plus one and copy all the values over - with the extra one

:/

That depends whether you can insert elements to any cell you see fit just like a regular array. What you are describing is Vector.
javajavajava - can you please post the complete instructions?

No, I cannot, unless you own a never ending hard drive.

;)

That depends whether you can insert elements to any cell you see fit just like a regular array. What you are describing is Vector.
javajavajava - can you please post the complete instructions?

It certainly isn't since a Vector doesn't increase its size by one when it grows, unless you've manually set the capacityIncrement to 1.

protected int capacityIncrement

    The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity. If the capacity increment is less than or equal to zero, the capacity of the vector is doubled each time it needs to grow.

Why do you need a never ending array??

Does this mean that you will create a never ending program??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.