Meaningless Drivel is fun!
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
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.
I agree. Here's the link:
subject: Collection
It's not a secret anymore!