yangyi
项目合作联系我: yangyi_love@hotmail.com

导航

统计
公告
 

2010年2月3日

对ArrayList迭代操作的过程中出现remove或者add时会抛出java.util.ConcurrentModificationException

异常产生的代码:

for(Object o:arralylist)

{

  if(true) arralylist.remove(o);

}

解决方法:

for(int i=0;i<arralylist.size();i++)

{

  if(true)

  {

    arralylist.remove(o);

    i--;

  }

}

posted @ 2010-02-03 10:39 谁是菜鸟? 阅读(197) 评论(0) 编辑