---
title: "ConcurrentModificationException和增强for循环"
author: "esteem"
date: "2009-05-07T15:20:35Z"
tags: []
slug: "concurrentmodificationexception-for"
draft: false
lastmod: "2009-05-07T15:20:35Z"
id: 380844
url: "https://esteem.iteye.com/blog/380844"
---

今天在做个小程序的时候，出现如下问题：

一个线程在读一个list，另外一个线程会对集合进行删除，直接通过list.remove(obj)就会抛出异常ConcurrentModificationException，这个时候我们可以通过Iterator的方法进行删除，it.remove()

 

做个记录

mark