//  Data Structures with Java by John R. Hubbard
//  Copyright McGraw-Hill, 2001
//  Example 2.9 on page 35
//  Testing the java.util.Vector class

import java.util.*;

public class Ex0209
{ private static Vector v = new Vector();
  private static Vector w = new Vector();
  public static void main(String[] args)
  { String[] cities = { "Austin", "Boston", "Fresno", "Toledo" }; 
    v.addAll(Arrays.asList(cities));
    System.out.println("v = " + v);
    v.add("Tucson");
    System.out.println("v = " + v);
    w = (Vector)v.clone();
    System.out.println("w = " + w);
    System.out.println("w.equals(v) = " + w.equals(v));
    v.set(3,"Ottowa");
    System.out.println("v = " + v);
    System.out.println("w = " + w);
    System.out.println("w.equals(v) = " + w.equals(v));
    v.insertElementAt("London",3);
    System.out.println("v = " + v);
    System.out.println("w = " + w);
    System.out.println("w.equals(v) = " + w.equals(v));
    w.removeElementAt(1);
    w.removeElementAt(3);
    w.remove("Fresno");
    System.out.println("w = " + w);
    v.addAll(5,w);
    System.out.println("v = " + v);
    System.out.println("v.indexOf(\"Austin\") = "
                      + v.indexOf("Austin"));
    System.out.println("v.indexOf(\"Austin\",2) = "
                      + v.indexOf("Austin",2));
    System.out.println("v.indexOf(\"Dublin\") = "
                      + v.indexOf("Dublin"));
  }
}
