Does a HashMap collision cause a resize?

前端 未结 4 1937
别那么骄傲
别那么骄傲 2021-01-14 15:03

When there is a collision during a put in a HashMap is the map resized or is the entry added to a list in that particular bucket?

4条回答
  •  再見小時候
    2021-01-14 15:23

    Resising is done when the load factor is reached.

    When there is a collision during a put in a HashMap the entry is added to a list in that particular "bucket". If the load factor is reached, the Hashmap is resized.

提交回复
热议问题