Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collections

 
Bill Norton
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have looked at HashTable, trees, etc for my situation but having a hard choosing which one is the best choice.
My data might look like this each entry has:
Social Security Number <- unique
Company Number <- unique
Job <- not-unique
Age <- not-unique
Now I need to be able to search Social Security Number or Company Number get the other three items
I will never need to search by Job or Age.
What is the best coolection for this. Also, this may or not be important but the serial numbers follow a tree structure.
Any help would be welcome.
Bill
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about storing all the information in an ArrayList, and then store the arraylist in a hasmap twice. using the SS# and Company # as the keys. OTOH, you can just use two maps.

Bosun
 
Bill Norton
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank for the suggestions. What would be the fastest way?
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic