While reading about difference of HashMap and HashTable I came across following statement.
Iterator in the HashMap is fail-safe while the enumerator for the Hashtable isn't.
Fail-safe is relevant from the context of iterators. If an iterator has been created on a collection object and some other
thread tries to modify the collection object "structurally", a concurrent modification exception will be thrown. It is possible for other threads though to invoke "set" method since it doesn't modify the collection "structurally". However, if prior to calling "set", the collection has been modified structurally, "IllegalArgumentException" will be thrown.
I could not understand that why should the exception be throw only when there is structural modification.
Can some one please give example.