• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hash Tables, Hash Sets

 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser Linux VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everyone,

I've coded in Java for a few semesters now, but not in any of my classes has a hash table or hash set/maps come up. I see people using them in their source code they post on this forum, but i'm not really sure what they do that's better than ways i code. So i was wondering if someone could fill me in on their uses and functionality.


Thanks.
Hunter.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want to make an association between a key and a value? Map Man to the rescue!
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser Linux VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a key to encrypt information?? I'm not really sure what you mean.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's say you want to convert state codes to their names.

What's better:
48 more times

or


?

 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser Linux VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so for something like what you just described would you need two maps?? one for the stateName and one for the keys? or does one map hold the name and the key ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look up java.util.Map. A single map equates the keys with their values. Some languages refer to these as Dictionaries I believe.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic