Originally posted by Henry Wong:
Amit,
Peter is not saying that certain operations don't have to be synchronized -- I believe he is pointing out that just synchronization at the collection level is not enough.
For example, I have to iterate through the collection, in a thread safe manner. In this case, only getting the iterator is synchronized, which is not good enough. I have to synchronize at a higher scope -- getting the iterator, iterating through the values to calculate a result, and possibly placing the result back.
You have to look at what you are doing and synchronize accordingly -- not just synchronize a collection because it is used by many threads.
Henry