Appends or inserts the specified element into the specified vector.

Parameters:

v

The vector object.

Note: The null value passed in this parameter will cause an error.

element
The element to be inserted.
index
The index at which the specified element is to be inserted.

If not specified, the element will be added at the end of the vector.

If less than 0, the element will be inserted at the first position.

If greater or equal the current vector size, the element will be added at the end of the vector.

Returns:

The same vector object.
See Also:
addElements(), removeElement()

Tip:

You may call this function in a more method-like style:

v.addElement(element)
That's why the operated vector is returned as the function result. The following will append two elements to the vector:
v.addElement(element1).addElement(element2)