0

If two objects have same hashCode, they would go into same bucket, which is same index in hashTable. Thing that surprised me is that I read some people say bucket=node.But is it?

After JVM checks they are not equal, it would store both of those two objects into bucket using linkedList implementation. Is that where are they in nodes now or what are they called here now?

I am sorry for not being precise. Can someone correct me as I am bad at terminology here. And I saw few sources not being precise about that.

Bottom line: What are nodes and what are buckets in this simple 'story'? Thanks :)

Ana Maria
  • 475
  • 2
  • 11
  • 2
    Does [this other question](https://stackoverflow.com/questions/37959941/what-exactly-is-bucket-in-hashmap) answer yours? – JustAnotherDeveloper Aug 19 '20 at 21:26
  • 2
    A node is one single key-value pair. A bucket is a collection of nodes. In HashMap the collection is a linked list at first but if the number of nodes gets big enough it's changed into a binary search tree – Joni Aug 19 '20 at 21:42

0 Answers0