2016-07-22

Hashmap capacity, load factor and fail-fast

Capacity :

  •     Capacity is the Number of element HashMap can contain. 
  •     initial capacity is the capacity at the time the hash table is created 
  •     default initial capacity (16) 
  •     capacity increased (2 power n) , where n- number of elements
load factor :

  • Defines threshold of HashMap. When re-sizing will occur of HashMap.
  • The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased.
  • default load factor (.75)
fail-fast :


  • The iterators returned by all of this class's are fail-fast
  •  After the iterator is created, if the map is modified at any time it will throw a ConcurrentModificationException

No comments:

Post a Comment