{"action":"created","issue":{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/976","labels_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/976/labels{/name}","comments_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/976/comments","events_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/976/events","html_url":"https://github.com/AsyncHttpClient/async-http-client/issues/976","id":107845690,"number":976,"title":"FluentCaseInsensitiveStringsMap keyLookup un-sync with values after iterator remove","user":{"login":"ben-tsai","id":6532397,"avatar_url":"https://avatars.githubusercontent.com/u/6532397?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-tsai","html_url":"https://github.com/ben-tsai","followers_url":"https://api.github.com/users/ben-tsai/followers","following_url":"https://api.github.com/users/ben-tsai/following{/other_user}","gists_url":"https://api.github.com/users/ben-tsai/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-tsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-tsai/subscriptions","organizations_url":"https://api.github.com/users/ben-tsai/orgs","repos_url":"https://api.github.com/users/ben-tsai/repos","events_url":"https://api.github.com/users/ben-tsai/events{/privacy}","received_events_url":"https://api.github.com/users/ben-tsai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-23T03:59:26Z","updated_at":"2015-09-24T07:38:24Z","closed_at":null,"body":"After using FluentCaseInsensitiveStringsMap.entrySet().iterator() to remove entries from map, keyLookup map loses sync with values map.\r\n\r\nTo reproduce:\r\n\r\n```java\r\nFluentCaseInsensitiveStringsMap map = new FluentCaseInsensitiveStringsMap();\r\nmap.add(\"a\", \"AAA\");\r\nmap.add(\"b\", \"BBB\");\r\nmap.add(\"c\", \"CCC\");\r\n\r\nfor (Iterator<Map.Entry<String, List<String>>> iter = map.entrySet().iterator(); iter.hasNext(); ) {\r\n    if (iter.next().getKey().equalsIgnoreCase(\"a\")) {\r\n        iter.remove();\r\n    }\r\n}\r\n\r\nSystem.out.println(\"map.toString(): \" + map.toString());\r\nSystem.out.println(\"map.keySet().toString(): \" + map.keySet().toString());\r\nSystem.out.println(\"map.containsKey(\\\"a\\\"): \" + map.containsKey(\"a\"));\r\nSystem.out.println(\"map.get(\\\"a\\\"): \" + map.get(\"a\"));\r\nSystem.out.println(\"map.get(\\\"b\\\"): \" + map.get(\"b\"));\r\nSystem.out.println(\"map.get(\\\"xxx\\\"): \" + map.get(\"xxx\"));\r\n```\r\n\r\nOutput:\r\n\r\n```\r\nmap.toString(): \"b=BBB\"; \"c=CCC\"\r\nmap.keySet().toString(): [a, b, c]         // expected [b, c]\r\nmap.containsKey(\"a\"): true                 // expected false\r\nmap.get(\"a\"): null                         // expected empty set \r\nmap.get(\"b\"): [BBB]\r\nmap.get(\"xxx\"): []                         // just to show what is returned when key doesn't exist\r\n```\r\n\r\nThanks\r\nBen"},"comment":{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/comments/142840162","html_url":"https://github.com/AsyncHttpClient/async-http-client/issues/976#issuecomment-142840162","issue_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/976","id":142840162,"user":{"login":"slandelle","id":849197,"avatar_url":"https://avatars.githubusercontent.com/u/849197?v=3","gravatar_id":"","url":"https://api.github.com/users/slandelle","html_url":"https://github.com/slandelle","followers_url":"https://api.github.com/users/slandelle/followers","following_url":"https://api.github.com/users/slandelle/following{/other_user}","gists_url":"https://api.github.com/users/slandelle/gists{/gist_id}","starred_url":"https://api.github.com/users/slandelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slandelle/subscriptions","organizations_url":"https://api.github.com/users/slandelle/orgs","repos_url":"https://api.github.com/users/slandelle/repos","events_url":"https://api.github.com/users/slandelle/events{/privacy}","received_events_url":"https://api.github.com/users/slandelle/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T07:38:24Z","updated_at":"2015-09-24T07:38:24Z","body":"ping @jfarcand "}}