vector : LUSENET : Java Programming : One Thread

Can anybody tell me what this means?? and how i can go about using this!! The Vector insertElementAt( element, position) method will insert the element in the first argument at the position indicated by the second argument. Use this method to add a third option to the menu which will add a new element to the start of the list (position 0).

-- gary collis (, February 14, 2001



-- hiralal sudarshan gullapalli (, June 25, 2001.

insertElementAt( element, position) //insertElementAt public void insertElementAt(Object obj, int index) 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(Object, int) 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.

Parameters: obj - the component to insert. index - where to insert the new component. Throws: ArrayIndexOutOfBoundsException - if the index was invalid.

-- bill (, November 08, 2002.

Moderation questions? read the FAQ