I must admit, I think it's unlikely that the
HashMap class simply isn't working correctly - it's too fundamental for basic bugs in it not to be widely known. But beyond what's already been suggested it's difficult to say definitively what's going wrong unless you can give us a standalone example that demonstrates the problem (a
SSCCE), that we can run for ourselves.