Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Collection  RSS feed

 
Chris Chua
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Thanks
Chris
 
Zkr Ryz
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use HasTable and an Employee class and do something like :
HashTable records = new HashTable();
Employee chris = new Employee( 1, "Chris", "Your address");
records.put( new Integer(1), chris );
more code here();
.
.
.
and retrive it
Employee emp = ( Employee ) records.get(new Integer(1));
Check the API
java.util.HashTable
By the way , if you find a better solution let me know
;o)
P.S. You can figure the Employee class source code rigth?, If you don't tell me and I'll be glad to post it

Originally posted by Chris Chua:
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.
Thanks
Chris

 
Chris Chua
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Zkr Ryz
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!