Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic