Looking at the code specifically line 393, it looks like different hashes have been mapped to same index. I had an understanding that the hashcode is used to determine what
This check is an optimization taking into account for collisions.
You can have 2 elements that have the same hash key (due to collision) and as a result are mapped to the same bucket. Same key different actual elements.
So if e.hash != hash
you don't need to check for equality (which could be an expensive operation)