Exception in thread "main" java.util.ConcurrentModificationException
package test; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; public class Test { public static void main(String[] args) { List list = new ArrayList();
list.add("1");
list.add("2");
list.add("3"); Iterator iterator = list.iterator();
while(iterator.hasNext()){ Object next = iterator.next();
if(next.equals("2")){
list.add("5");
}else{
System.out.println(next);
}
}
System.out.println(list);
} }
Exception in thread "main" java.util.ConcurrentModificationException的更多相关文章
- Exception in thread "main" java.util.ConcurrentModificationException解决方案
我想判断一个集合里面有没有"world"这个元素,如果有,我就添加一个"javaee"元素, 当时的做法是: public class ListIterator ...
- Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 0 [ ^
Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character clas ...
- Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 0 解决方法: 要对切割字符进行转义\\
使用str.split("[",15)时,出现Exception in thread "main" java.util.regex.PatternSyntaxE ...
- Exception in thread "main" java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for topic_test_1219-2: 30010 ms has passed since batch creatio
代码如下 public static void producer1() throws ExecutionException, InterruptedException { Properties pro ...
- Exception in thread "main" java.util.InputMismatchException
今天写代码来了一个异常 /** * 需求分析:根据输入的天数是否是周六或是周日, * 并且天气的温度大于28摄氏度,则外出游泳,否则钓鱼 * @author chenyanlong * 日期:2017 ...
- WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable Exception in thread "main" java.io.IOException: No FileSystem for sc F
1.执行脚本程序报如下所示的错误: [hadoop@slaver1 script_hadoop]$ hadoop jar web_click_mr_hive.jar com.bie.hive.mr.C ...
- Exception in thread "main" java.lang.StackOverflowError at java.util.ArrayList$SubList.rangeCheckForAdd(Unknown Source)
Exception in thread "main" java.lang.StackOverflowError at java.util.ArrayList$SubList.ran ...
- unit测试出现异常:Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform.commons.util
在进行单元测试时,测试出现异常 Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform ...
- Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/util/POILogFactory
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/util/POILogFacto ...
随机推荐
- Strobogrammatic Number II -- LeetCode
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside ...
- luogu P1146 硬币翻转
题目描述 在桌面上有一排硬币,共N枚,每一枚硬币均为正面朝上.现在要把所有的硬币翻转成反面朝上,规则是每次可翻转任意N-1枚硬币(正面向上的被翻转为反面向上,反之亦然).求一个最短的操作序列(将每次翻 ...
- [POI2006]Periods of Words
题目大意: 给定一个长度为$n(n\leq10^6)$的字符串$S$,定义一个串$S$的最大周期为一个不为$S$的字符串$Q$,满足$Q$为$S$的前缀且$S$为$QQ$的前缀.求字符串$S$的每一个 ...
- IntelliJ IDEA控制台Console里没有查找快捷键
问题描述:之前的项目一直用的 Eclipse,习惯了其快捷键的使用,现在的项目换到IntelliJ IDEA,为了尽快上手,就把快捷键Keymap修改为Eclipse方式.发现在控制台Console里 ...
- Visual Studio 插件开发资源
微软官方MSDN 官方MSDN永远是最大而全的电子字典Visual Studio Software Development Kit ,不过它的资料虽然详细,但没有一定的基础的话直接使用它的话有点无从入 ...
- 解读TDD的五大误区
所谓TDD简单地说就是以下两个步骤:确保所有的需求都能被照顾到:在代码不断增加和重构的过程中,可以检查所有的功能是否正确.本文我们一起来看下关于TDD的五大误区. TDD(全称Test Driven ...
- ios学习流水账1
1.UIImageview设边框.圆角 需要引QuartzCore/QuartzCore.h> //设UIImageView边框 CALayer *layer = [m_imgView laye ...
- wp8手机浏览器项目
项目需求如下: 1.页面布局 最上方为搜索/网址框 中间为网页显示区,默认主页为百度搜索 最下方为功能栏,分别有后退,前进,窗口和更多功能 在更多功能中有 分享给好友 发送网址到桌面 查看历史记录等 ...
- 文本文件打印类库(C#)
我写了一个打印文本文件的类库,功能包含:打印预览.打印.打印时能够选择打印机.能够指定页码范围. 调用方法很easy: TextFilePrinter p = new TextFilePrinter( ...
- Python图像处理(11):k均值
快乐虾 http://blog.csdn.net/lights_joy/ 欢迎转载,但请保留作者信息 K均值是一个经典的聚类算法,我们试试在python下使用它. 首先以(-1.5, -1.5)和(1 ...