Output :
Dog key
New Dog Key
collection.Dog@35ce36
collection.Dog@757aef
null
null
New Dog Key
New Dog Key
Question
Object ref "d" is used as a key for the value "New Dog Key". the hashcode for object of class Dog,
is used as the length of variable "name".
As per the
SCJP 1.6, Chap 7 , when the value of "name" for object ref "d" is changed to "magnolia" ie. d.name = "magnolia"; the object will be searched in a hash bucket other than that where the object was placed originally ie hash bucket returned when value of "name" was diego.
Hence, the System.out.println(m.get(d)); should return null!!
But, as you can see the code returns an output with value "new Dog Key".
I dont understand ?