Udostępnij za pośrednictwem


Vector.InsertElementAt(Object, Int32) Method

Definition

Inserts the specified object as a component in this vector at the specified index.

[Android.Runtime.Register("insertElementAt", "(Ljava/lang/Object;I)V", "GetInsertElementAt_Ljava_lang_Object_IHandler")]
public virtual void InsertElementAt (Java.Lang.Object? obj, int index);
[<Android.Runtime.Register("insertElementAt", "(Ljava/lang/Object;I)V", "GetInsertElementAt_Ljava_lang_Object_IHandler")>]
abstract member InsertElementAt : Java.Lang.Object * int -> unit
override this.InsertElementAt : Java.Lang.Object * int -> unit

Parameters

obj
Object

the component to insert

index
Int32

where to insert the new component

Attributes

Remarks

Inserts the specified object as a component in this vector at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously.

The index must be a value greater than or equal to 0 and less than or equal to the current size of the vector. (If the index is equal to the current size of the vector, the new element is appended to the Vector.)

This method is identical in functionality to the #add(int, Object) add(int, E) method (which is part of the List interface). Note that the add method reverses the order of the parameters, to more closely match array usage.

Java documentation for java.util.Vector.insertElementAt(E, 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