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 ...
随机推荐
- WC 2018/CTSC 2018/APIO 2018 游记
(要写CTSC的时候才想起来没写WC2018,那就粗略回顾一下吧hhhhh) WC 2018(简略版): 大概和 一个宁夏和一个天津的大哥一个宿舍hhhh,字典序分宿舍真是奇妙. WC讲课真的不是人听 ...
- [CF617E]XOR and Favorite Number/[CQOI2018]异或序列
题目大意: 给定一个长度为$n(n\leq10^5)$的数列$A$和数$k$$(A_i,k\leq10^6)$.$m$组询问,每次询问区间$[l,r]$中有多少对$i,j(l\leq i\leq j\ ...
- 基于Bootstrap的下拉框插件bootstrap-select
写在前面: 在这次的项目中,没有再使用liger-ui做为前端框架了,改为了Bootstrap,这次也好接触下新的技术,在学习的过程中发现,Bootstrap的一些组件基本都是采用class的形式,就 ...
- Java多线程设计模式(1)
1 线程中的几个方法解释 Thread.sleep(long 毫秒) 在指定的时间内让当前线程休眠,将控制权交给其他线程,休眠的线程依旧拥有它所占用的锁, Thread.yield(); 暂停或者放弃 ...
- 导出/导入Eclipse的workspace配置(备份Eclipse配置)
设置好workspace配置后可以将配置保存为 *.epf 文件. 进入 File -> Export : 选择 General -> Preferences ,下一步: 选择 Expor ...
- ASIHTTPRequest学习(二)
Handling compressed responses, and compressing request bodies Using gzip to handle compressed respon ...
- CM3大礼包
- ES6中的迭代器(Iterator)和生成器(Generator)(二)
一.内建迭代器 迭代器是ES6的一个重要组成部分,在ES6中,已经默认为许多内建类型提供了内建迭代器,只有当这些内建迭代器无法实现目标时才需要自己创建.通常来说当定义自己的对象和类时才会遇到这种情况, ...
- oracle闪回flashback_transaction_query知识点
查询更新记录: select t.start_timestamp, t.commit_timestamp, t.logon_user, t.operation, t.table_name, t.tab ...
- 3. Spring Boot热部署【从零开始学Spring Boot】
转载:http://blog.csdn.net/linxingliang/article/details/51584549 在编写代码的时候,你会发现我们只是简单把打印信息改变了下,就需要重新部署,如 ...