Vector is
  • stretchable
  • work as FIFO
  • easy to append to existing element and increase.
  • clear the contents in one shot.
  • after clearing the contents, the capacity of Vector remains same and unchanged.
Example

import java.io.*;
import java.util.List;
import java.util.Arrays;// to use arrays
import java.util.*;// Arrays.sort
public class Test_This {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
Process p1 = new Process();
p1.method_1();
}
}
class Process
{
String first[] = {"Java","A+","C#","XML","JSP","PHP","Z", "C#"};
//to be used with set add all change other wise
String[] second = {"0.0","0.1","0.2","0.3","0.2","0.4"};
//vector is stretchable

public Process()
{
System.out.println("Default) constructor");
}
public void method_1()
{

Vector<String> vt = new Vector<String>(Arrays.asList(first));

for(String s1 : second)
{
vt.addElement(s1);
}
System.out.println(vt);
System.out.println("Vector grew to : " + vt.size());
System.out.println("Vector capacity before clear: " + vt.capacity());
vt.clear();
System.out.println("Vector after clear : " +vt);
System.out.println("Vector capacity after clear: " + vt.capacity());
}
}