Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4196794

Vector's equals() method can not work correctly.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P2 P2
    • None
    • 1.1.8, 1.2.0
    • core-libs

      JDK Version: jdk118
      OS: Solaris 2.6
      Locale: C, zh

      Vector.equals(Object) can not work correctly. If we construct two Vectors,
      and assigned them the same value, but the equals() method would return
      a "false" boolean value. If we set jdk to 1.2fcs, the return value will
      be "true".
      Following is a short program to reproduce it:

      ==========================TestVector.java=================================
      import java.util.*;

      public class TestVector {

          public static void main(String args[]) {
      Vector v1 = new Vector();
      v1.addElement("White");
      v1.addElement("Black");
      v1.addElement("Green");

      Vector v2 = new Vector();
      v2.addElement("White");
      v2.addElement("Black");
      v2.addElement("Green");

      System.out.println("v1 = ");
      System.out.println(v1);
      System.out.println("v2 = ");
      System.out.println(v2);
      System.out.println("v1.equals(v2): " + v1.equals(v2));
          }
      }



      ===========================================================================

      jim.hu@prc 1998-12-11

            jjb Josh Bloch
            jhusunw Jim Hu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: