hashmap原理没弄清楚

Users u0=new Users();
    Users u1=new Users();
    u0.setId(1);
    u1.setId(1);
       map.put("Aa", u1);
       map.put("BB", u0);
       System.out.println(u0.equals(u1)); //已经重写 true
    System.out.println(map); //输出两个对象 put成功
    System.out.println("Aa".hashCode()+" "+"BB".hashCode()); hashcode都是2112
    为什么元素还能插进去  ,不应该是先判断hashcode 再equals 发现都相等,就不查了 吗

http://www.importnew.com/7099.html

Aa和BB虽然hashcode相等,但是equals不等。两个对象以链表的形式存储在相同的index下

hashmap能不能**put**进入是以**key**的**hash**为标准的,而字符串"**Aa**"和字符串"**BB**"的**hash**明显是不想等的,所以是可以插入的.

如果你插入的方式是

map.put( u1,"Aa");
map.put( u0,"BB");

这样就只能插入一个对象,