By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,083 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,083 IT Pros & Developers. It's quick & easy.

benefits of hash code

P: n/a
What are some of the benefits of using a hash table data structure?
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
jova wrote:
What are some of the benefits of using a hash table data structure?

I found hashtables to be very useful when needing to sort through a
large set of classes. Each class has a name property, when i add a class
to the hashtable i do something like:

Hashtable table = new Hashtable();
Human newHuman = new Human();
newHuman.setName("Carl");
table.put(newHuman.getName(),newHuman);

thus, i can sort the hashtable by each Human's name.

anyway, once the hashtable is populated, i can easily search the table
with the containsKey() method, to see if a Human is in this table.

That's all i normally use it for, massive class searching by name.

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.