ConcurrentModificationException并发修改异常
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                ConcurrentModificationException并发修改异常
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                A:ConcurrentModificationException出現:
/*Iterator it = list.iterator(); //獲取迭代器while(it.hasNext()) { //判斷集合中是否有元素String str = (String)it.next(); //向下轉型if("world".equals(str)) {list.add("javaee"); //遍歷的同時在增加元素,并發修改ConcurrentModificationException}}*/?
B:解決方案
* a:迭代器迭代元素,迭代器修改元素(ListIterator的特有功能add)
* b:集合遍歷元素,集合修改元素
轉載于:https://www.cnblogs.com/loaderman/p/6407359.html
總結
以上是生活随笔為你收集整理的ConcurrentModificationException并发修改异常的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 1.7 Python基础知识 - 模块初
- 下一篇: UVA 10603 - Fill(dij
