首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

加强for循环里操作集合抛出ConcurrentModificationException

2013-04-22 
增强for循环里操作集合抛出ConcurrentModificationException自定义了一个简单的Student类,发现如下方法会

增强for循环里操作集合抛出ConcurrentModificationException
自定义了一个简单的Student类,发现如下方法会抛出一个
java.util.ConcurrentModificationException

Student studentToDelete = new Student();studentToDelete.setId(1);studentList.remove(studentToDelete);

不过后者的限制是只移除第一个符合条件的元素

热点排行