This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Collection" Watch "Collection" New topic


Chris Chua

Joined: Feb 21, 2001
Posts: 24
Hi I wanted to store set of information like employee number, employee name, and employee address what class in the collection framework do i have to use so that when i search on the employee number, it would give me the employee name and address, could somebody pls help me with some code.
karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
did you try Hashtable in java.util ?
it takes a key and a value (your key would be the number, the value the name)

Chris Chua

Joined: Feb 21, 2001
Posts: 24
yes i used Hashtable the employee num is the key and the name is the value but how about the employee add?
Nisha Siddiqui

Joined: Jun 07, 2001
Posts: 5
You could maybe have a Hashtable which holds another Hashtable as its value, with name and address?
It is however expensive to create so many hashtables!
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Or you could create an Employee class that holds all this information, and then make a HashTable of Employees, using their number as the key...


Write once, run anywhere, because there's nowhere to hide! - /. A.C.
It is sorta covered in the JavaRanch Style Guide.
subject: Collection
Similar Threads
Passing more than one data to bean
Java Reflection
How to print ArrayList values?