The iterator behaves the same as ConcurrentHashMap's iterator. From CHM's documentation:
"Similarly, Iterators and Enumerations return elements reflecting the state of the hash table
at some point at or since the creation of the iterator/enumeration. They do <em>not</em>
throw {@link ConcurrentModificationException}. However, iterators are designed to be used
by only one thread at a time."
You can safely iterate a map being concurrently operated on, but the iterator should not be shared between threads.
On Wednesday, March 28, 2012 1:21:31 PM UTC-7, NikNik77771 wrote:
Is map.keySet().iterator() threadsafe?