What is the function of a load factor in a Hashtable?
Location: http://www.jguru.com/faq/view.jsp?EID=246454 Created: Nov 6, 2000 Modified: 2000-11-06 09:37:38.855 Author: Jef Newsom (http://www.jguru.com/guru/viewbio.jsp?EID=129583) Question originally posed by Siddhartha Mehta (http://www.jguru.com/guru/viewbio.jsp?EID=235146 The load factor determines how full a hashtable may get before it expands its capacity. I think that the comments on the Hashtable API docs explain it very well: The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased. When the number of entries in the hashtable exceeds the product of the load factor and the current capacity, the capacity is increased by calling the rehash method. Generally, the default load factor (.75) offers a good tradeoff between time and space costs. Higher values decrease the space overhead but increase the time cost to look up an entry (which is reflected in most Hashtable operations, including get and put).