Home Segments Top Top Previous Next

561: Mainline

To insert an element at a particular place, you use the insertElementAt method, providing an instance and an integer index as arguments. Thus, if you want to add elements to the front end of a vector, displacing all other elements, you use insertElementAt with an index of 0:

v.insertElementAt(m, 0)