Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

xml parsing.

 
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.
 
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.
 
Marshal
Posts: 24594
55
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).
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • 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!