The java.util.vector.equals(Object obj) method of Vector class in Java is used verify the equality of an Object with a vector and compare them. The list returns true only if both Vector contains same elements with same order.
Parameters: This method accepts a mandatory parameter second_vector which refers to the second Vector to be compared to the first Vector.
Return value: The method returns true if the equality holds and both the objects and vector are equal else it returns false.
Below programs are used to illustrate the working of the java.util.Vector.elements() method:
The Vector is: [Geeks, 4, Geeks, Welcomes, You] The Vector is: [Geeks, 4, Geeks, Welcomes, You] Are both of them equal? true
Program 2 :
The Vector is: [10, 15, 20, 25, 30] The Vector is: [10, 15, 20, 25, 30, 40] Are both of them equal? false
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Method Class | equals() Method in Java
- Java.util.Arrays.equals() in Java with Examples
- Overriding equals method in Java
- Difference between == and .equals() method in Java
- Calendar.equals() method in Java
- Java Long equals() method with Examples
- Character.equals() method in Java with examples
- Double.equals() Method in Java with Examples
- MathContext equals() Method in Java
- BigDecimal equals() Method in Java
- EnumMap equals() Method in Java with Examples
- IdentityHashMap equals() Method in Java
- GregorianCalendar equals() Method in Java
- BigInteger equals() Method in Java
- Java 8 Clock equals() Method with Examples
- ConcurrentSkipListSet equals() method in Java
- FloatBuffer equals() method in Java with Examples
- IntBuffer equals() method in Java
- LongBuffer equals() method in Java
- ShortBuffer equals() method in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.