0
点赞
收藏
分享

微信扫一扫

SpringMvc中Hashmap操作遇到 java.util.ConcurrentModificationException: null

天涯学馆 2022-08-18 阅读 98

代码按照网上修改为类似,还不能解决问题

for (Iterator<String> it = target.keySet().iterator(); it.hasNext(); ) {
if(...)
it.remove();
}

,后来根据异常名称,推测是在Servlet多线程环境下保持,换成并发ConcurrentHashMap就解决问题了。

 

 

参考:

HashMap报错:java.util.ConcurrentModificationException


举报

相关推荐

0 条评论