100
Java Vector equals() Method
The equals() method of Java Vector class used to compare the specified object with this Vector for equality. It returns true if and only if the specified object is also a list, both lists have the same size and all corresponding pairs of elements in the two lists are equal.
Syntax:
Following is the declaration of equals() method:
Parameter:
Parameter | Description | Required/Optional |
---|---|---|
o | It is the object to be compared for equality with the vector which is in use. | Required |
Returns:
The equals() method returns true if the specified object is equal to this Vector, otherwise returns false.
Exceptions:
NA
Compatibility Version:
Java 1.2 and above
Example 1:
Output:
Is vector1 equals vector2 ? false
Example 2:
Output:
Is vector1 equals vector2 ? true Vector list: [1, 2, 3, 1, 2, 3]
Next TopicJava Vector