• Post Reply Bookmark Topic Watch Topic
  • New Topic

load factor in collections  RSS feed

 
satish bodas
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
Am trying to understand the load factor concept .

Have a couple of questions regarding the same ::

Is load factor only applicable to Maps ?
Is it applicable to List ?

Also was reading this article ::
http://www.oracle.com/technology/pub/articles/maps1.html

An excerpt ::

The load factor itself is a tuning tradeoff between space and time. Smaller load factors will take more space but will reduce the likelihood of collisions, thus making access and updates faster. Load factors above 0.75 are probably unwise, and above 1.0 are definitely unwise since that guarantees at least one collision. Load factors below 0.50 will give you diminishing returns, but there should be no performance cost to small load factors as long as you size the map effectively, only a memory cost. But smaller load factors will imply more frequent resizing if you don't pre-size the Map, and that will incur a performance penalty, so do bear that in mind if you are tuning the load factor


Not understood what is collission - is this something specific to how hash implementations are done ?

Could someone throw some pointers ?

Thanks ,
~satish
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Load factor is specific to hashed collections. Lists are unlikely to have a concept of load factor.

The article to which you refer has an explanation of how hashing works. Did you read it?
 
satish bodas
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I did read the article but have not understood / digested the details .
Will read it once more and come up with the points I dont understand .

Thanks ,
~satish
 
Anil Kumar Saha
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The meaning of "load factor of a hashtable=0.75" is if the hashtable is 75% full, then it will be re-hashed two times of the initial capacity.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!