java.util.ConcurrentModificationException
at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:)
at com.lh.technologysupport.view.activity.ResponseActivity.lambda$initDynamicEvents$$ResponseActivity(ResponseActivity.java:)
addTraffic.setOnClickListener(v -> {
String newTag = trafficClassChart.getText().toString().trim();
if (!StringUtil.isEmptyStr(newTag)) {
List<String> tagsNew = new ArrayList<>();
List<String> tags = tagContainerTraffic.getTags();
if (tags == null || tags.isEmpty()) {
tagsNew.add(newTag);
} else {
for (String s : tags) { // 改成 fori 循环 !
if (!s.equals(newTag)) {
tags.add(newTag);
}
}
tagsNew.addAll(tags);
}
tagContainerTraffic.setTags(tagsNew);
}
});

解决方式:把增强 for 改成 for(i) 循环!

参考:https://blog.csdn.net/wchicho/article/details/51987992

Java Bug -- java.util.ConcurrentModificationException的更多相关文章

  1. 再次踩bug:遍历删除list(java.util.ConcurrentModificationException)

    再次踩bug:遍历删除list(java.util.ConcurrentModificationException) 使用 List<Long> list = new ArrayList& ...

  2. java.util.ConcurrentModificationException详解

    引用于http://blog.csdn.net/dabing69221/article/details/40065071 在使用set/map时,一个可爱的小bug:Java.util.Concurr ...

  3. CAS (15) — CAS 线上环境 Ehcache Replication 的非稳定重现错误 java.util.ConcurrentModificationException

    CAS (15) - CAS 线上环境 Ehcache Replication 的非稳定重现错误 摘要 线上环境在 EhCache Replication 过程中出现 java.util.Concur ...

  4. java.util.ConcurrentModificationException 异常解决的方法及原理

    近期在修程序的bug,发现后台抛出下面异常: Exception in thread "main" java.util.ConcurrentModificationExceptio ...

  5. java.util.ConcurrentModificationException 解决办法(转载)

    今天在项目的中有一个需求,需要在一个Set类型的集合中删除满足条件的对象,这时想当然地想到直接调用Set的remove(Object o)方法将指定的对象删除即可,测试代码:   public cla ...

  6. java.util.ConcurrentModificationException --map

    key:3-key key:/v1.02-key Exception in thread "main" java.util.ConcurrentModificationExcept ...

  7. 偶遇到 java.util.ConcurrentModificationException 的异常

    今天在调试程序 遇到了如此问题 贴上代码来看看稍后分析 List<String> list = null;boolean isUpdate = false;try { list = JSO ...

  8. 对ArrayList操作时报错java.util.ConcurrentModificationException null

    用iterator遍历集合时要注意的地方:不可以对iterator相关的地方做添加或删除操作.否则会报java.util.ConcurrentModificationException 例如如下代码: ...

  9. LinkedList - java.util.ConcurrentModificationException

    package com.test.io; import java.io.BufferedReader; import java.io.FileNotFoundException; import jav ...

随机推荐

  1. 非常好的开源C项目tinyhttpd(500行代码)

    编译命令 gcc -W -Wall -lpthread -o httpd httpd.c 源码 #include <stdio.h> #include <sys/socket.h&g ...

  2. 新建一个self hosted Owin+ SignalR Project(1)

    OWIN是Open Web Server Interface for .Net 的首字母缩写,他的定义如下: OWIN在.NET Web Server 与Web Application之间定义了一套标 ...

  3. C/C++ 宏技巧

    1. C 也可以模板化 #define DEFINE_ARRAY_TYPE(array_type_, element_type_) \ static inline int array_type_ ## ...

  4. DP常用模板

    递推模板: 从结果往回推,需要设定边界为无穷大,并建立状态转移方程 ;j<n;j++) d[n][j]=a[n][j];///边界处理 ;i>=;i--){ ;j<i;j++)/// ...

  5. PythonStudy——字典的定义 Dictionary definition

    # 空字典 d1 = {} d2 = dict() # 用map映射创建字典 d3 = dict({'a': 1, 'b': 1}) print(d3) # 用关键字赋值方式 d4 = dict(na ...

  6. IntelliJ IDEA 2018.3 升级功能介绍

    |0前言 2018.11.28 IntelliJ IDEA 2018.3 正式版发布.对于一个忠实爱好者,迫不及待的我下载了最新版本来体验下.而且 IDEA 今年的第三次重大更新提供了不容错过的显著功 ...

  7. 1.1.17 Word在表格中插入竖排文字,显示一半

    隐藏效果如下所示: 这是因为文字的[段落行距]设置为[固定值],将文字选中,设置为[单倍行距]即可.

  8. Spark Streaming 'numRecords must not be negative'问题解决

    转载自:http://blog.csdn.net/xueba207/article/details/51135423 问题描述 笔者使用spark streaming读取Kakfa中的数据,做进一步处 ...

  9. 1、minimum-depth-of-binary-tree

    题目描述 Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the ...

  10. 【剑指offer】合并有序链表

    输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则. *思路:假设两个链表的当前结点为n1(list1),n2(list2)比较链表结点值的大小,如果n1.va ...