Difference between HashTable and HashMap
2 posts in topic
Flat View  Flat View

Posted By:   Shreya_Sreejith
Posted On:   Friday, October 7, 2005 08:56 PM

Could you suggest the different situations where we prefer HashTable over a HashMap and vice vera?

I have a typical scenario in which a set of values have to be passed to Database for a search. One of the search criteria are some values which in the front end are keyed in through a text area(as comma/space spearated value, which is unparsed before sending to the dB for query). So, there is a possibility of repeatedly entering the same values for search. Here, in the existing code I saw the usage of Hashmap to store these values.What would be the specific reason of using a HashMap instead of a HashTable in this case?

Re: Difference between HashTable and HashMap

Posted By:   Jagadeesh_Kumar  
Posted On:   Tuesday, October 25, 2005 03:04 AM

Overall performance is best with the HashMap. The Hashtable is synchronized so performance is slightly worse. The performance of the Properties class is almost identitcal to the HashTable.

So it totally depends on the task which you are doing to select HashMap or HashTable. Suppose if ur task includes hitting the database with number of values everytime then its better to use HashMap instead of HashTable as the performance gets decreased worsely. If your task is getting the local entities or values from any other method or object, you can use HashTable as it is syncronized.

Re: Difference between HashTable and HashMap

Posted By:   Jani_Kaarela  
Posted On:   Monday, October 10, 2005 04:30 AM

FAQ!!! x(

About | Sitemap | Contact