HashMaps with Comparable keys not working as expected
问题 We're facing weird issues with how HashMap behaves. When HashMap keys implement Comparable interface but compareTo implementation is inconsistent with equals then HashMaps: grow much larger then they are supposed to grow they contain several instances of equal elements values attached to those elements might differ get(key) result depends on which key is used (even if the keys are equal according to equals method). I've created a small test to reproduce the problem (see below). import java