0

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.

5
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by Eric Cute
0

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

:/

Edited by hanvyj: n/a

0

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?

0

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.
0

Why do you need a never ending array??

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.