• Post Reply Bookmark Topic Watch Topic
  • New Topic

xml parsing.  RSS feed

 
T sandya
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application,they are parsing the XML document,and putting the data in Hashmap.I am not getting why they are using Hashmap only instead of using the Hashtable.Almost in entire application they are using Hashmap only.

can any one argue me,why i cann't use Hashtable.

thanks and regards,
sandya.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why Hashtable? Hashtable is synchronized to start with. HashMap will give you better performance over Hashtable.
 
Paul Clapham
Sheriff
Posts: 22828
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hashtable versus Hashmap? Nothing to do with XML. Moving to Java in General (Intermediate).
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because Hashtable is an old, legacy collection class, and you should not use it if there isn't a specific reason to do so.

You should always use HashMap instead of Hashtable, which is the new and more efficient dictionary collection class available since Java 1.2.

The question should not be "why are all my colleagues using HashMap instead of Hashtable"; instead, you should ask yourself "why am I using Hashtable while all my colleagues are using HashMap".
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!