从源码看:为什么不能在for 循环中对集合进行add

1. 编写代码:
从源码看:为什么不能在for 循环中对集合进行add
lab-1.png
2. 看编译后的 .class文件
从源码看:为什么不能在for 循环中对集合进行add
lab-2.png
3. 可以看出for循环底层实现还是iterator, 接下来看iterator
从源码看:为什么不能在for 循环中对集合进行add
lab-3.png
4. 结果
从源码看:为什么不能在for 循环中对集合进行add
lab-4.png