Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

rehash() method use with respect to hashtable

 
Mathew Lee
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would like to know what is the use of rehash() method. when do we use it. What is the significance of using it. Any ideas, suggestions, resources, links highly appreciated. Thanks in advance
 
Costi Ciudatu
Ranch Hand
Posts: 74
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

/**
* Increases the capacity of and internally reorganizes this
* hashtable, in order to accommodate and access its entries more
* efficiently. This method is called automatically when the
* number of keys in the hashtable exceeds this hashtable's capacity
* and load factor.
*/
protected void rehash()

The JavaDoc says it all. Besides, you can only invoke this method if you extend from Hashtable, since it's protected.
Most likely, you'll never need to deal with it (or even know of its existence).
 
Campbell Ritchie
Marshal
Posts: 52636
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Costi Ciudatu wrote:. . . Most likely, you'll never need to deal with it (or even know of its existence).
Good answer
 
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!