Blogger

Delete comment from: Javarevisited

Good one. But I have a question. How does an entry with null key is handled in Hashmap? I mean, one can't calculate hashcode on null so how could an entry with null key get a bucket?

Suppose it is placed at 0 th bucket, but then if 0 th bucket has multiple entries in the linked list (the entries whose keys got hashcode 0 when calculated.) Then how is it resolved, as we can't even call equals method on null!

Aug 30, 2012, 2:15:31 AM


Posted to How HashMap works in Java?

Google apps
Main menu