This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Hashmap or hashtable or ...., which one is faster for a searchable key value storage? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Hashmap or hashtable or ...., which one is faster for a searchable key value storage?" Watch "Hashmap or hashtable or ...., which one is faster for a searchable key value storage?" New topic
Author

Hashmap or hashtable or ...., which one is faster for a searchable key value storage?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
Hi
Thank you for reading my post
looking at
http://www.coderanch.com/t/233717/threads/java/Hashtable-or-HashMap

http://forum.java.sun.com/thread.jspa?threadID=487732&messageID=2285137

and

http://www.artima.com/forums/flat.jsp?forum=1&thread=78029

I am confused and i can not understand whether hashmap is faster or hashtable.

my requirement is to store a pair of key,value and be able to search based on key.

now, which collection class i should choose?

Thanks
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Originally posted by raminaa niilian:
which collection class i should choose?


Hashtable should never be used in new code except if you have to work with an older API that wants a Hashtable as a method argument. Otherwise, use HashMap, always.


[Jess in Action][AskingGoodQuestions]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hashmap or hashtable or ...., which one is faster for a searchable key value storage?
 
Similar Threads
Getting error while compiling
Hide Source Code in Struts
The use of TreeMap
Displaying Binary Data Fetched with AJAX
calculate duration between two dates