how a vector is grows when the size is reached

suppose the specified size is completes, and when we add a new element , how the vector grows
[100 byte] By [sudha_1234a] at [2007-10-2 21:44:05]
# 1

When the size (the number of elements in a vector) equals the capacity

(the potential number of elements in a vector), a new array is allocated

which is larger than the current array, the contents of the current array

is copied to the new array and the capacity is increased accordingly.

kind regards,

Jos

JosAHa at 2007-7-14 0:59:33 > top of Java-index,Java Essentials,New To Java...
# 2
i want that size to create a new array with already specified size.
sudha_1234a at 2007-7-14 0:59:33 > top of Java-index,Java Essentials,New To Java...
# 3

> i want that size to create a new array with already

> specified size.

Vector is legacy, you should use ArrayList.

When you create a Vector you can specify initial capacity and capacity increment. The capacity increment is the amount by which the capacity is increased when the Vector overflows.

YoGeea at 2007-7-14 0:59:33 > top of Java-index,Java Essentials,New To Java...