Vector.EnsureCapacity(Int32) Method

Definition

Increases the capacity of this vector, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.

[Android.Runtime.Register("ensureCapacity", "(I)V", "GetEnsureCapacity_IHandler")]
public virtual void EnsureCapacity (int minCapacity);
[<Android.Runtime.Register("ensureCapacity", "(I)V", "GetEnsureCapacity_IHandler")>]
abstract member EnsureCapacity : int -> unit
override this.EnsureCapacity : int -> unit

Parameters

minCapacity
Int32

the desired minimum capacity

Attributes

Remarks

Increases the capacity of this vector, if necessary, to ensure that it 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, unless the value of capacityIncrement is less than or equal to zero, in which case the new capacity will be twice the old capacity; but if this new size is still smaller than minCapacity, then the new capacity will be minCapacity.

Java documentation for java.util.Vector.ensureCapacity(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also