aspose file tools
The moose likes Beginning Java and the fly likes Advice HashMap? HashTable? anything? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Advice HashMap? HashTable? anything?" Watch "Advice HashMap? HashTable? anything?" New topic
Author

Advice HashMap? HashTable? anything?

Allen Thomas
Greenhorn

Joined: Jul 02, 2002
Posts: 29
Hi everyone,
Would anyone recommend me on what I should use if I am pulling data from a table in a database. This data is 4 fields and I don't want to search through a resultset for a particular record to retreive the 4 field values. (Also I can't because the jdbc api says I can't open more than one statement per connection.) So, I would like to store the 4 field values for each record in a, what they call in the C language struct-like, structure. Would HashMap, HashTable, be efficient and sufficient enough for me to handle this operation? If not, what would you recommend me?

Thank you.
Allen
Chris Stehno
Ranch Hand

Joined: Feb 26, 2001
Posts: 180
Either a HashMap or Hashtable would be fine. I would recommend using a HashMap though, they do not have the forced synchronized methods which slow things down if you don't need them.
Hope this helps.


- Chris Stehno, SCPJ
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

See this series on the collection framework to see if the collection you've chosen fits your requirements
Storing Objects in Java by Thomas Paul:
Part 1 - The List Interface
Part 2 - The Set Interface
Part 3 - The Map Interface
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by Jamie Robertson:
See this series on the collection framework to see if the collection you've chosen fits your requirements
Storing Objects in Java by Thomas Paul:

Jamie's my new buddy!!!


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Advice HashMap? HashTable? anything?
 
Similar Threads
Locking - Notification issues
HashMap vs Hashtable
zero-based or one-based records
Problem wiht the load() method while using the Properties object
Using Properties instead of HashMap when dealing with Strings