I think you can still have the same hash code for different keys with this code.
The solution is to never assume that hash code eq means object eq