Removing an Element
Frequently you wish to remove an element
from a list.
The Vector class has a method that will do this without leaving
a hole in place of the deleted element:
removeElementAt(int index) // Deletes the element at index. Each element with an index
// greater than index is shifted downward to have an index
// one smaller than its previous value.
The element at location index will be eliminated.
Elements at locations index+1, index+2, ... , size()-1 will each be moved down one
to fill in the gap.
This is like pulling out a book from the middle of a stack of books.
|