This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Collections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Collections" Watch "Collections" New topic


Bill Norton

Joined: Mar 29, 2001
Posts: 27
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.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
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.


So much trouble in the world -- Bob Marley
Bill Norton

Joined: Mar 29, 2001
Posts: 27
Thank for the suggestions. What would be the fastest way?
I agree. Here's the link:
subject: Collections
It's not a secret anymore!