2015年10月14日

Java集合类ArrayList循环中删除特定元素

摘要: 在项目开发中,我们可能往往需要动态的删除ArrayList中的一些元素。一种错误的方式:[java]view plaincopyfor(inti=0,len=list.size();isListIterator=list.iterator();while(sListIterator.hasNext(... 阅读全文

posted @ 2015-10-14 23:03 何林子 阅读(173) 评论(0) 推荐(0) 编辑

解决ArrayList的ConcurrentModificationException

摘要: 1问题:在list 中清空所有的记录,只使用使用单循环,不使用removeAll()2可以写出五种方式,代码如下:Java代码importjava.util.ArrayList;importjava.util.Iterator;importjava.util.List;publicclassList... 阅读全文

posted @ 2015-10-14 22:49 何林子 阅读(1072) 评论(0) 推荐(0) 编辑

导航