map遍历判断筛选删除时 如果对map使用put、remove或clear方法(例如map.remove直接删除),那么迭代器就不再合法(并且在其后使用该迭代器将会有ConcurrentModificationException异常被抛出). 当Iterator.remove方法导致map发生变化时,他会更新cursor来同步这一变化。 参见jdk文档描述: The iterators returned by all of this class's "collection view methods" are fail-fast: if the map is structurally modified at any time after the iterator is created, in any way except through the iterator's own remove method, the iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic