Vector Class
Home ] Up ] [ Vector Class ] Enumeration Interface ] Vector/Enumeration Example ]

 

 

Vector is a class that implements a kind of dynamic array.  

Object
    Dictionary (abstract)
        Hashtable
            Properties
    Vector
        Stack

You can add instances of any class to it, using methods:

  • add(...)
  • addElement(...)
  • etc...

and then retrieve them using a number of methods:

  • elementAt()
  • firstElement()
  • lastElement()
  • toArray()
  • etc.

You can remove elements from the Vector :

  • remove()
  • removeElementAt()
  • removeAll()
  • removeRange()
  • etc.

and you can replace an element with another element:

  • set()
  • setElementAt()

You can also obtain the elements stored in a Vector by using an Enumeration, returned from the Vector by calling the method:

  • elements()

Note that Vector is being replaced by ArrayList.  (see later).

 

This page was last modified on 02 October, 2007