HashMap Collision
public class Simple{
public static void main(String args[]){
Map map=new HashMap();
map.put(1, 11);
map.put(4, 11);
System.out.println(map.hashCode());
Map map1=new HashMap();
map1.put(1, 11);
map1.put(4, 11);
System.out.println(map1.hashCode());
if (map.equals(map1)) {
System.out.println("equal ");
}
}}
public static void main(String args[]){
Map
map.put(1, 11);
map.put(4, 11);
System.out.println(map.hashCode());
Map
map1.put(1, 11);
map1.put(4, 11);
System.out.println(map1.hashCode());
if (map.equals(map1)) {
System.out.println("equal ");
}
}}
25
25
equal
25
equal
Comments
Post a Comment