Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero.
Constructs a vector containing the elements of the specified collection, in the order they are returned by the collection's iterator.
Constructs an empty vector with the specified initial capacity and with its capacity increment equal to zero.
Vector(int initialCapacity, int capacityIncrement)
Constructs an empty vector with the specified initial capacity and capacity increment.
Originally posted by thomas davis:
Case 1)Vector objVector = new Vector(5,10);
If I have a vector intitialized as given above,and I add 6 th element to it ,How the vector will react to it?How does the internal array get incremented?
What is the significance of 5 and 10?
, and 10 is
the initial capacity of the vector.
the amount by which the capacity is increased when the vector overflows.
Does it give a crappy performance?
What do I have to do it for better performance?
Vector objVector = new Vector();
by adding the one element int the vector, what would be the Vectors size?, What would be the internal data array's size ?, add a 2nd element what would be the internal array size?
public Vector()Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero.
protected int capacityIncrementThe 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.