Computer Science, asked by ritikgupta5935, 11 months ago

What does the method ensureCapacity(int, minCapacity) do in java?

Answers

Answered by jaswanth200518
0

The ensureCapacity(int minCapacity) method is used to increases the capacity of this vector, if necessary.This is to ensure that the vector can hold at least the number of components specified by the minimum capacity argument.If the current capacity of this vector is less than minCapacity, then its capacity is increased by replacing its internal data array, kept in the field elementData, with a larger one. The size of the new data array will be the old size plus capacityIncrement.

Similar questions