Class java.util.Vector: Used as list


  • Vector can be seen as list datastructure or as sizable array.
  • List - data structure for storing any kind of different objects:
    Vector mylist = new Vector();
    String test = "test";
    mylist.addElement( new String("Name") );
    mylist.addElement( test );
    mylist.addElement( new AnyObject() );
    mylist.addElement( new AnyOtherObject() );
    
    It can easily be checked if a certain element is contained or elments can be inserted and removed.
    mylist.insertElementAt( new YetAnotherObject(), 2);
    if (mylist.contains(test))
    	mylist.removeElement(test);
    

Java Tutorial - Standard Classes Jens Trapp, 1997