Which one is better to use hashtable or hashmap in ejbs?
4 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, September 30, 2004 10:44 AM


Which one is better to use hashtable or hashmap in ejbs?

Re: Which one is better to use hashtable or hashmap in ejbs?

Posted By:   Anonymous  
Posted On:   Tuesday, October 5, 2004 06:33 AM

Use Hashtable in multithreaded environment, in others use HashMap.



In Hashtable, the addition/retreival methods are synchronized.


A synchronized method can be accessed by ONLY by a single thread at a time. Other threads wait for this sync. method till the currently executing thread is done.


Performance would be less using Hashtable when compared to HashMap.




Use Hashtable ONLY in multi-threaded environment.

Re: Which one is better to use hashtable or hashmap in ejbs?

Posted By:   Vinod_K  
Posted On:   Tuesday, October 5, 2004 04:39 AM

hashmap is better because it is asynchronous multiple clients can acess at a time.But in case of hashtable it is synchronous ie (legacy collection)

Re: Which one is better to use hashtable or hashmap in ejbs?

Posted By:   jaivir_singh  
Posted On:   Thursday, September 30, 2004 11:55 PM

Criteria for finding out the suitability of HashMap & HashTable for a given purpose is independant of weather u use any of them in EJB or Java Bean or a normal java class.



So choose which one is suitable for your requirement and go ahead and use it in ur EJB.



Jaivir

Re: Which one is better to use hashtable or hashmap in ejbs?

Posted By:   Anand_Rajasekar  
Posted On:   Thursday, September 30, 2004 12:29 PM

Use HashMap's .. hashtable is a legacy datastructure
About | Sitemap | Contact