foreach 中无法删除和添加元素
fail-fast 是一种通用的系统设计思想,一旦检测到可能会发生错误,就立马抛出异常
throw new ConcurrentModificationException();
抛出 ConcurrentModificationException 异常之后不需要捕获,直接中止程序
示例
class TEST {
public static void main(String[] args) {
ArrayList<Integer> integers = new Array...
zhengsongling.com3 min read