How Synchornize an obects stored in an arraylist or Hashmap
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   g_v
Posted On:   Monday, March 29, 2004 10:56 AM

How Synchornize an obects stored in an arraylist or Hashmap

Re: How Synchornize an obects stored in an arraylist or Hashmap

Posted By:   Anonymous  
Posted On:   Monday, April 5, 2004 09:25 AM

ArrayList is not synchronized. Use Vector instead if you're concerned about concurrent accesses to your objects.



Likewise, HashMap isn't synchronized. Use Hashtable instead.

Re: How Synchornize an obects stored in an arraylist or Hashmap

Posted By:   Glenn_Mason  
Posted On:   Wednesday, March 31, 2004 11:59 PM

You mean you're getting an object from an ArrayList, modifying it, and then want to resynchronize it with the contents of the ArrayList?



I'm not 100% sure on this, but the get() method should give you a reference to the object in the ArrayList ... therefore any changes are already accessible through the ArrayList.



Otherwise you'll have to re-set() the object back into the ArrayList ... same goes for a Hashmap.

About | Sitemap | Contact