How java HashMap does chaining? how to access all collision values?

前端 未结 5 1746
一个人的身影
一个人的身影 2020-12-11 07:27

I have read somewhere that HashMap uses chaining to resolve collisions. But if that is the case. how can i access all the elements with same key value.

For example :

5条回答
  •  一整个雨季
    2020-12-11 07:46

    I don't think HashTable allows duplicate keys. You should read this What happens when a duplicate key is put into a HashMap?

提交回复
热议问题