{"comment":{"url":"https://api.github.com/repos/directhex/wrench-aggregator/comments/13820038","html_url":"https://github.com/directhex/wrench-aggregator/commit/242b2aecf5a5296ebe774a5af98caf91562452e6#commitcomment-13820038","id":13820038,"user":{"login":"duncanmak","id":4791,"avatar_url":"https://avatars.githubusercontent.com/u/4791?v=3","gravatar_id":"","url":"https://api.github.com/users/duncanmak","html_url":"https://github.com/duncanmak","followers_url":"https://api.github.com/users/duncanmak/followers","following_url":"https://api.github.com/users/duncanmak/following{/other_user}","gists_url":"https://api.github.com/users/duncanmak/gists{/gist_id}","starred_url":"https://api.github.com/users/duncanmak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duncanmak/subscriptions","organizations_url":"https://api.github.com/users/duncanmak/orgs","repos_url":"https://api.github.com/users/duncanmak/repos","events_url":"https://api.github.com/users/duncanmak/events{/privacy}","received_events_url":"https://api.github.com/users/duncanmak/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":"","commit_id":"242b2aecf5a5296ebe774a5af98caf91562452e6","created_at":"2015-10-16T15:41:49Z","updated_at":"2015-10-16T15:41:49Z","body":"Is this really necessary? This is exactly the sort of stuff I was talking about in my comment a few commits ago.\r\n\r\nMy reasoning is that, anytime I see a `remove` inside a foreach loop, I fear that it would lead to a problem like this. I thought what you had earlier was fine, because, as you said, you were iterating over the `keySet` and not the actual `statusCache`. So why is this extra cloning necessary?\r\n\r\nAll of this is to say, it's much better if we could write code like this:\r\n\r\n```java\r\nvar toRemove = getNotRunning(statusCache, runsRightNow); // pseudo-code\r\nstatusCache.removeAll(toRemove)\r\n```\r\n\r\nAlas, I see that `Map` does not have a `removeAll` method.\r\n\r\nLooking around, I think the general guidance to use the iterator explicitly, and use `iter.remove()`, which is what I remembered from before as well. This is icky, but I can live with this.\r\n\r\nI also just found this - http://stackoverflow.com/a/22679166/494990 - if this works (let's test it in a one-off Java script), then this is definitely the better way."}}