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 ...
随机推荐
- Linked List Random Node -- LeetCode
Given a singly linked list, return a random node's value from the linked list. Each node must have t ...
- 【bzoj2190】【仪仗队】欧拉函数+线性筛(浅尝ACM-J)
向大(hei)佬(e)势力学(di)习(tou) Description 作为体育委员,C君负责这次运动会仪仗队的训练.仪仗队是由学生组成的N * N的方阵,为了保证队伍在行进中整齐划一,C君会跟在仪 ...
- elasticsearch 分布式部署
修改配置文件 /config/elasticsearch.yml 我用两台机器,内网地址分别为230 和 231 处理启动报错一: [2017-01-12T15:55:55,433][INFO ][o ...
- 解决android模拟器连接本机服务器”Connection refused”问题
在本机用模拟器连接 localhost 的服务器不成功,经查询是我反了一个小错误. android 模拟器其本身的localhost就是它自己的ip,而如果我要连接本机的localhost则需要将 ...
- Android Developer -- Bluetooth篇 开发实例之一 扫描设备
第一步:声明Bluetooth Permissions <!-- 设置蓝牙访问权限 --> <uses-permission android:name="android.p ...
- debug with Linux slub allocator
http://thinkiii.blogspot.jp/2014/02/debug-with-slub-allocator.html The slub allocator in Linux has ...
- Android笔试总结
1.请谈一下Android系统的架构.答:Android系统采用了分层架构,从高层到低层分别是应用程序层.应用程序框架层.系统运行库层和linux核心层. 2.谈谈android大众常用的五种布局.答 ...
- squid.conf 的cache_peer 详解
通过squid.conf配置文件中的cache_peer选项来配置代理服务器阵列,通过其他的选项来控制选择代理伙伴的方法.Cache_peer的使用格式如下: cache_peer hostname ...
- ylbtech-WelfareSystem(福利发放管理系统)-数据库设计
ylbtech-DatabaseDesgin:ylbtech-WelfareSystem(福利发放管理系统)-数据库设计 1.A,数据库关系图(Database Diagram) 1.B,数据库设计脚 ...
- 智能选择器和语义化的CSS
本文由白牙根据Heydon Pickering的<Semantic CSS With Intelligent Selectors>所译,整个译文带有我自己的理解与思想,如果译得不好或不对之 ...