If object1 and object2 are two different types of objects but implement the same interface I, and we assume object1 and object2 have same hash code.
There is a HashMap<I, String>.
So we can call put(object1, "some string") and put(object2, "some string") by that hash map.
My understanding is:
- For put()function, the position of the object in hash map depends on the hash code of the key object. After theobject1put into the map first, then we try to putobject2. It will find the position has been occupied byobject1already. So theobject2will be put intoobject1's next position.
- For get()function, if we callget(object2), it will findobject1first, and findobject1 != object2, then it will continue to compare the next element of object1 until find the same object withobject2
Just want to know if I am correct? Or any supplement information within this mechanism.
 
     
     
    