Advanced Minds

  • Decrease font size
  • Default font size
  • Increase font size
  • default color
  • red color
  • green color
FireBoard
Welcome, Guest
Please Login or Register.    Lost Password?
difference between hashmap and hashtable? difference between hashmap and hashtable (1 viewing) (1) Guests
Go to bottom Post Reply Favoured: 0
TOPIC: difference between hashmap and hashtable? difference between hashmap and hashtable
#3393
TP (Visitor)
Click here to see the profile of this user
Birthdate:
difference between hashmap and hashtable? difference between hashmap and hashtable  
A hashmap is not synchronized and faster than hashtable. In a servlet application when you have httpsession to take care of session independance, is there any reason that I should use hashtable over hashmap? Thanks.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#3394
Anton Spaans (Visitor)
Click here to see the profile of this user
Birthdate:
difference between hashmap and hashtable? difference between hashmap and hashtable  
A hashmap is not synchronized and faster than hashtable. In a servlet application when you have httpsession to take care of session independance, is there any reason that I should use hashtable over hashmap? Thanks. Usually not, unless you cache static data that is initialized lazily (i.e. loaded when it becomes available first, afterwards it is only read, never updated). If you do not need any cached data (used by the entire application, regardless of request/session), there is no real need for hashtable. If you have cached data that is read on initialization (during the servlet's init() method), there is no real need for hashtable. In both cases hashmap is fine. (this does not deal with any clustering of web-servers and such. I assume that data can be cached statically)
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#3395
Adam Jenkins (Visitor)
Click here to see the profile of this user
Birthdate:
difference between hashmap and hashtable? difference between hashmap and hashtable  
A hashmap is not synchronized and faster than hashtable. In a servlet application when you have httpsession to take care of session independance, is there any reason that I should use hashtable over hashmap? The Hashtable class was created before the current Collection API was designed.  There's really no reason to ever use Hashtable anymore except for interacting with existing code which uses a Hashtable.  If you need a synchronized version of HashMap, you can get it by calling Map syncedMap = Collections.synchronizedMap(new HashMap()); Adam
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#3396
Tony Morris (Visitor)
Click here to see the profile of this user
Birthdate:
difference between hashmap and hashtable? difference between hashmap and hashtable  
A hashmap is not synchronized and faster than hashtable. In a servlet application when you have httpsession to take care of session independance, is there any reason that I should use hashtable over hashmap? Thanks. Whether or not you provide thread safety to the data held by the structure is entirely up to how you access (read/write) it. If you need thread safety, the Collections way (as opposed to the old Hashtable way) of doing that is: Map m = new Collections.synchronizeMap(new HashMap());
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#3397
TP (Visitor)
Click here to see the profile of this user
Birthdate:
difference between hashmap and hashtable? difference between hashmap and hashtable  
A hashmap is not synchronized and faster than hashtable. In a servlet application when you have httpsession to take care of session independance, is there any reason that I should use hashtable over hashmap? The Hashtable class was created before the current Collection API was designed.  There's really no reason to ever use Hashtable anymore except for interacting with existing code which uses a Hashtable.  If you need a synchronized version of HashMap, you can get it by calling Map syncedMap = Collections.synchronizedMap(new HashMap()); Adam
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#3398
Anton Spaans (Visitor)
Click here to see the profile of this user
Birthdate:
difference between hashmap and hashtable? difference between hashmap and hashtable  
A hashmap is not synchronized and faster than hashtable. In a servlet application when you have httpsession to take care of session independance, is there any reason that I should use hashtable over hashmap? The Hashtable class was created before the current Collection API was designed.  There's really no reason to ever use Hashtable anymore except for interacting with existing code which uses a Hashtable.  If you need a synchronized version of HashMap, you can get it by calling Map syncedMap = Collections.synchronizedMap(new HashMap()); Adam Hi Adam, Why shouldn't you use Hashtable if you need a synchronized (hash-)map? The class nor its methods are deprecated. And the Collections.synchronizedMap(...) creates an extra _object_  (implementing Map) as a wrapper around the input-map. Why would you want to do that, if you have a perfectly good Hashtable lying around?
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
brak autoryzacji sprawdz autoryzacje nieautoryzowano no auth 905
online pharmacy dell coupon cucina pro 1711 diving african american inventors