equals(Object): This method is available in java.util.Hashtable class of Java.
Syntax:
boolean java.util.Hashtable.equals(Object o)
This method takes one argument. This method compares the specified Object with this Map for equality, as per the definition in the Map interface.
Parameters: One parameter is required for this method.
o: object to be compared for equality with this hashtable.
Returns: true if the specified Object is equal to this Map.
Exceptions: NA
Approach
Java
import java.util.Hashtable;public class Hashtableequals {public static void main(String[] args) {Hashtable<String, Integer> hashtable =new Hashtable<String, Integer>();hashtable.put("Hello", 1);hashtable.put("World", 2);Hashtable<String, Integer> o =new Hashtable<String, Integer>();o.put("Hello", 1);o.put("World", 2);System.out.println(hashtable.equals(o));}}
Output:
true
No comments:
Post a Comment