Compare two vectors

ReturnMethodSummary
booleanequals(Object o)Compares the specified Object with this Vector for equality.

import java.util.Arrays;
import java.util.Enumeration;
import java.util.Vector;

public class Main{

  public static void main(String args[]) {

    Vector v = new Vector();

    v.add("java2s.com");
    v.add("java2s.com");
    v.add("java2s.com");
    
    Vector v2 = new Vector();

    v2.add("java2s.com");
    v2.add("java2s.com");
    v2.add("java2s.com");
    
    System.out.println(v.equals(v2));
  }
}

The output:


true
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.