-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
1.2.0
-
sparc
-
solaris_2.6
JDK Version: Solaris_JDK_1.1.6_04
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));
}
}
===========================================================================
set jdk to Solaris_JDK_1.1.6_04
javac TestVector.java
java TestVector
v1 =
[White, Black, Green]
v2 =
[White, Black, Green]
v1.equals(v2): false
set jdk to 1.2fcs-R
java TestVector
v1 =
[White, Black, Green]
v2 =
[White, Black, Green]
v1.equals(v2): true
[jim.hu@prc 1998-11-18]
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));
}
}
===========================================================================
set jdk to Solaris_JDK_1.1.6_04
javac TestVector.java
java TestVector
v1 =
[White, Black, Green]
v2 =
[White, Black, Green]
v1.equals(v2): false
set jdk to 1.2fcs-R
java TestVector
v1 =
[White, Black, Green]
v2 =
[White, Black, Green]
v1.equals(v2): true
[jim.hu@prc 1998-11-18]
- duplicates
-
JDK-4196794 Vector's equals() method can not work correctly.
-
- Closed
-