Java Map.equals(Object o)
Syntax
Map.equals(Object o) has the following syntax.
boolean equals(Object o)
Example
In the following code shows how to use Map.equals(Object o) method.
//www . j av a2 s . c om
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] a) {
Map<String,String> map = new HashMap<String,String>();
map.put("key1", "value1");
map.put("key2", "value2");
map.put("key3", "value3");
Map<String,String> map2 = new HashMap<String,String>();
map2.put("key2", "value2");
map2.put("key1", "value1");
map2.put("key3", "value3");
System.out.println(map2.equals(map2));
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »