If you see Javadoc for the modCountHashMap field (in the Java 8 source HashMap.java), you will see:
, , . ConcurrentModificationException ( ), expectedModCount ( modCount , , Iterator<Map.Entry<String, String>> itr = map.entrySet().iterator();) modCount, , (, put , ). , . , , ).
, - ( , ). , , Manish Updated , ( 4 ). , , , ConcurrentModificationException.
(: ):
List<String> names = Arrays.asList("Larry", "Moe", "Curly");
int i = 0;
Iterator<String> strIter = names.iterator();
while (strIter.hasNext()) {
names.set(i, strIter.next() + " " + i);
i += 1;
}
System.out.println(names);
:
[Larry 0, Moe 1, Curly 2]