Stephen Westbom wrote:
Also, treat the objects in the collection as immutable as well. When you need to modify the collection create a new one and you can reference the objects in the old collection through its iterator and add, change or delete objects.
Finally, once you have built the new modified collection object then change the exposed reference to the object (for instance a method that hands you the iterator to the collection). Anyone who is reading the iterator when you change the collection reference maintains their handle to the old collection object until they release their handle. Any new accessors will get the new object.
Stephen,
Thanks for the enlightening comments (even though this wasn't my thread). But in the above, doesn't this violate the intent of the OP: a Collection that can be accessed (read-only) concurrently? You're saying that if the Collection is updated, the clients' references to the iterators will not be updated to match. Is that just how it goes and there's nothing to be done, or is there a way to update the client reference iterator of the change (without using some kind of subscribe/notify system)?
Erik
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
