This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes rehash() method use with respect to hashtable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "rehash() method use with respect to hashtable" Watch "rehash() method use with respect to hashtable" New topic
Author

rehash() method use with respect to hashtable

Mathew Lee
Ranch Hand

Joined: Jun 08, 2009
Posts: 238
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

Joined: Oct 24, 2006
Posts: 74

/**
* 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
Sheriff

Joined: Oct 13, 2005
Posts: 32694
    
    4
Costi Ciudatu wrote:. . . Most likely, you'll never need to deal with it (or even know of its existence).
Good answer
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: rehash() method use with respect to hashtable
 
Similar Threads
HashMap doubt . Thanks for comments.
HashMap behavior
Strategy Design Question
HASHTABLE Problem
Comparator and Comparable