{"action":"created","comment":{"url":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/comments/66368227","id":66368227,"diff_hunk":"@@ -0,0 +1,58 @@\n+package com.google.maps.android;\n+\n+import java.util.Collection;\n+import java.util.HashMap;\n+\n+/**\n+ * Extension of HashMap that provides two main features. Firstly it allows reverse lookup\n+ * for a key given a value, by storing a second HashMap internally which maps values to keys.\n+ * Secondly, it supports Collection values, in which case, each item in the collection is\n+ * used as a key in the internal reverse HashMap. It's therefore up to the caller to ensure\n+ * the overall set of values, and collection values, are unique.\n+ *\n+ * Used by GeoJsonRenderer to store GeoJsonFeature instances mapped to corresponding Marker,\n+ * Polyline, and Polygon map objects. We want to look these up in reverse to provide access\n+ * to GeoJsonFeature instances when map objects are clicked.\n+ */\n+public class BiMultiMap<K> extends HashMap<K, Object> {\n+\n+    private final HashMap<Object, K> mValuesToKeys = new HashMap<>();\n+\n+    public void putAll(HashMap<K, Object> map) {\n+        // put() manages the reverse map, so call it on each entry.\n+        for (Entry<K, Object> entry : map.entrySet()) {\n+            put(entry.getKey(), entry.getValue());\n+        }\n+    }\n+\n+    @Override\n+    public Object put(K key, Object value) {\n+        // Store value/key in the reverse map, and store each item in the value\n+        // if the value is a collection.\n+        if (value instanceof Collection) {","path":"library/src/com/google/maps/android/BiMultiMap.java","position":32,"original_position":32,"commit_id":"d40765ea69996dac3af4158b1267f5e753973fe3","original_commit_id":"d40765ea69996dac3af4158b1267f5e753973fe3","user":{"login":"markmcd","id":109308,"avatar_url":"https://avatars.githubusercontent.com/u/109308?v=3","gravatar_id":"","url":"https://api.github.com/users/markmcd","html_url":"https://github.com/markmcd","followers_url":"https://api.github.com/users/markmcd/followers","following_url":"https://api.github.com/users/markmcd/following{/other_user}","gists_url":"https://api.github.com/users/markmcd/gists{/gist_id}","starred_url":"https://api.github.com/users/markmcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markmcd/subscriptions","organizations_url":"https://api.github.com/users/markmcd/orgs","repos_url":"https://api.github.com/users/markmcd/repos","events_url":"https://api.github.com/users/markmcd/events{/privacy}","received_events_url":"https://api.github.com/users/markmcd/received_events","type":"User","site_admin":false},"body":"You could probably do this a little cleaner with a separate method. e.g.\r\n\r\n    public Object put(K key, Collection value) ...","created_at":"2016-06-09T01:04:17Z","updated_at":"2016-06-09T01:04:17Z","html_url":"https://github.com/googlemaps/android-maps-utils/pull/286#discussion_r66368227","pull_request_url":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/286","_links":{"self":{"href":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/comments/66368227"},"html":{"href":"https://github.com/googlemaps/android-maps-utils/pull/286#discussion_r66368227"},"pull_request":{"href":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/286"}}},"pull_request":{"url":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/286","id":72992093,"html_url":"https://github.com/googlemaps/android-maps-utils/pull/286","diff_url":"https://github.com/googlemaps/android-maps-utils/pull/286.diff","patch_url":"https://github.com/googlemaps/android-maps-utils/pull/286.patch","issue_url":"https://api.github.com/repos/googlemaps/android-maps-utils/issues/286","number":286,"state":"open","locked":false,"title":"Add support for click listeners on GeoJSON layers.","user":{"login":"stephenmcd","id":116385,"avatar_url":"https://avatars.githubusercontent.com/u/116385?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenmcd","html_url":"https://github.com/stephenmcd","followers_url":"https://api.github.com/users/stephenmcd/followers","following_url":"https://api.github.com/users/stephenmcd/following{/other_user}","gists_url":"https://api.github.com/users/stephenmcd/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenmcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenmcd/subscriptions","organizations_url":"https://api.github.com/users/stephenmcd/orgs","repos_url":"https://api.github.com/users/stephenmcd/repos","events_url":"https://api.github.com/users/stephenmcd/events{/privacy}","received_events_url":"https://api.github.com/users/stephenmcd/received_events","type":"User","site_admin":false},"body":"@markmcd PTAL, as discussed:\r\n\r\n- Features mapped to map objects are now stored in two-way map (BiMultiMap) so we can lookup feature by map object, when it's clicked on \r\n- BiMultiMap also handles collection values, so each collection item is stored as a key in the reverse map\r\n- GeoJSONLayer allows a single click listener to be created, for the common case of a single layer on a map\r\n- Multiple layers on a map are supported via GeoJSONLater. getFeature() which can be used to determine the layer a map object belongs to, inside the developer's own map click handlers.","created_at":"2016-06-08T06:22:13Z","updated_at":"2016-06-09T01:04:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"194d082b194a91d0864a0f2ecd44f52ebf28b3de","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/286/commits","review_comments_url":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/286/comments","review_comment_url":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/comments{/number}","comments_url":"https://api.github.com/repos/googlemaps/android-maps-utils/issues/286/comments","statuses_url":"https://api.github.com/repos/googlemaps/android-maps-utils/statuses/d40765ea69996dac3af4158b1267f5e753973fe3","head":{"label":"stephenmcd:clickable-geojson","ref":"clickable-geojson","sha":"d40765ea69996dac3af4158b1267f5e753973fe3","user":{"login":"stephenmcd","id":116385,"avatar_url":"https://avatars.githubusercontent.com/u/116385?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenmcd","html_url":"https://github.com/stephenmcd","followers_url":"https://api.github.com/users/stephenmcd/followers","following_url":"https://api.github.com/users/stephenmcd/following{/other_user}","gists_url":"https://api.github.com/users/stephenmcd/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenmcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenmcd/subscriptions","organizations_url":"https://api.github.com/users/stephenmcd/orgs","repos_url":"https://api.github.com/users/stephenmcd/repos","events_url":"https://api.github.com/users/stephenmcd/events{/privacy}","received_events_url":"https://api.github.com/users/stephenmcd/received_events","type":"User","site_admin":false},"repo":{"id":53106086,"name":"android-maps-utils","full_name":"stephenmcd/android-maps-utils","owner":{"login":"stephenmcd","id":116385,"avatar_url":"https://avatars.githubusercontent.com/u/116385?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenmcd","html_url":"https://github.com/stephenmcd","followers_url":"https://api.github.com/users/stephenmcd/followers","following_url":"https://api.github.com/users/stephenmcd/following{/other_user}","gists_url":"https://api.github.com/users/stephenmcd/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenmcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenmcd/subscriptions","organizations_url":"https://api.github.com/users/stephenmcd/orgs","repos_url":"https://api.github.com/users/stephenmcd/repos","events_url":"https://api.github.com/users/stephenmcd/events{/privacy}","received_events_url":"https://api.github.com/users/stephenmcd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stephenmcd/android-maps-utils","description":"Handy extensions to the Google Maps Android API.","fork":true,"url":"https://api.github.com/repos/stephenmcd/android-maps-utils","forks_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/forks","keys_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/teams","hooks_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/hooks","issue_events_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/issues/events{/number}","events_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/events","assignees_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/assignees{/user}","branches_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/branches{/branch}","tags_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/tags","blobs_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/languages","stargazers_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/stargazers","contributors_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/contributors","subscribers_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/subscribers","subscription_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/subscription","commits_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/contents/{+path}","compare_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/merges","archive_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/downloads","issues_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/issues{/number}","pulls_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/labels{/name}","releases_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/releases{/id}","deployments_url":"https://api.github.com/repos/stephenmcd/android-maps-utils/deployments","created_at":"2016-03-04T03:57:52Z","updated_at":"2016-03-04T03:57:55Z","pushed_at":"2016-06-08T06:15:26Z","git_url":"git://github.com/stephenmcd/android-maps-utils.git","ssh_url":"git@github.com:stephenmcd/android-maps-utils.git","clone_url":"https://github.com/stephenmcd/android-maps-utils.git","svn_url":"https://github.com/stephenmcd/android-maps-utils","homepage":"http://googlemaps.github.io/android-maps-utils/","size":1854,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"googlemaps:master","ref":"master","sha":"2131d02ff7dcb94a58d53f6ff5e0a4a9803b0f1c","user":{"login":"googlemaps","id":3717923,"avatar_url":"https://avatars.githubusercontent.com/u/3717923?v=3","gravatar_id":"","url":"https://api.github.com/users/googlemaps","html_url":"https://github.com/googlemaps","followers_url":"https://api.github.com/users/googlemaps/followers","following_url":"https://api.github.com/users/googlemaps/following{/other_user}","gists_url":"https://api.github.com/users/googlemaps/gists{/gist_id}","starred_url":"https://api.github.com/users/googlemaps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlemaps/subscriptions","organizations_url":"https://api.github.com/users/googlemaps/orgs","repos_url":"https://api.github.com/users/googlemaps/repos","events_url":"https://api.github.com/users/googlemaps/events{/privacy}","received_events_url":"https://api.github.com/users/googlemaps/received_events","type":"Organization","site_admin":false},"repo":{"id":10113030,"name":"android-maps-utils","full_name":"googlemaps/android-maps-utils","owner":{"login":"googlemaps","id":3717923,"avatar_url":"https://avatars.githubusercontent.com/u/3717923?v=3","gravatar_id":"","url":"https://api.github.com/users/googlemaps","html_url":"https://github.com/googlemaps","followers_url":"https://api.github.com/users/googlemaps/followers","following_url":"https://api.github.com/users/googlemaps/following{/other_user}","gists_url":"https://api.github.com/users/googlemaps/gists{/gist_id}","starred_url":"https://api.github.com/users/googlemaps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlemaps/subscriptions","organizations_url":"https://api.github.com/users/googlemaps/orgs","repos_url":"https://api.github.com/users/googlemaps/repos","events_url":"https://api.github.com/users/googlemaps/events{/privacy}","received_events_url":"https://api.github.com/users/googlemaps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/googlemaps/android-maps-utils","description":"Handy extensions to the Google Maps Android API.","fork":false,"url":"https://api.github.com/repos/googlemaps/android-maps-utils","forks_url":"https://api.github.com/repos/googlemaps/android-maps-utils/forks","keys_url":"https://api.github.com/repos/googlemaps/android-maps-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googlemaps/android-maps-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googlemaps/android-maps-utils/teams","hooks_url":"https://api.github.com/repos/googlemaps/android-maps-utils/hooks","issue_events_url":"https://api.github.com/repos/googlemaps/android-maps-utils/issues/events{/number}","events_url":"https://api.github.com/repos/googlemaps/android-maps-utils/events","assignees_url":"https://api.github.com/repos/googlemaps/android-maps-utils/assignees{/user}","branches_url":"https://api.github.com/repos/googlemaps/android-maps-utils/branches{/branch}","tags_url":"https://api.github.com/repos/googlemaps/android-maps-utils/tags","blobs_url":"https://api.github.com/repos/googlemaps/android-maps-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googlemaps/android-maps-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googlemaps/android-maps-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/googlemaps/android-maps-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googlemaps/android-maps-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/googlemaps/android-maps-utils/languages","stargazers_url":"https://api.github.com/repos/googlemaps/android-maps-utils/stargazers","contributors_url":"https://api.github.com/repos/googlemaps/android-maps-utils/contributors","subscribers_url":"https://api.github.com/repos/googlemaps/android-maps-utils/subscribers","subscription_url":"https://api.github.com/repos/googlemaps/android-maps-utils/subscription","commits_url":"https://api.github.com/repos/googlemaps/android-maps-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/googlemaps/android-maps-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/googlemaps/android-maps-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/googlemaps/android-maps-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/googlemaps/android-maps-utils/contents/{+path}","compare_url":"https://api.github.com/repos/googlemaps/android-maps-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googlemaps/android-maps-utils/merges","archive_url":"https://api.github.com/repos/googlemaps/android-maps-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googlemaps/android-maps-utils/downloads","issues_url":"https://api.github.com/repos/googlemaps/android-maps-utils/issues{/number}","pulls_url":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/googlemaps/android-maps-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/googlemaps/android-maps-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googlemaps/android-maps-utils/labels{/name}","releases_url":"https://api.github.com/repos/googlemaps/android-maps-utils/releases{/id}","deployments_url":"https://api.github.com/repos/googlemaps/android-maps-utils/deployments","created_at":"2013-05-17T00:08:48Z","updated_at":"2016-06-08T11:25:29Z","pushed_at":"2016-06-08T06:22:13Z","git_url":"git://github.com/googlemaps/android-maps-utils.git","ssh_url":"git@github.com:googlemaps/android-maps-utils.git","clone_url":"https://github.com/googlemaps/android-maps-utils.git","svn_url":"https://github.com/googlemaps/android-maps-utils","homepage":"https://developers.google.com/maps/documentation/android-api/utility/","size":4587,"stargazers_count":1472,"watchers_count":1472,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":695,"mirror_url":null,"open_issues_count":112,"forks":695,"open_issues":112,"watchers":1472,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/286"},"html":{"href":"https://github.com/googlemaps/android-maps-utils/pull/286"},"issue":{"href":"https://api.github.com/repos/googlemaps/android-maps-utils/issues/286"},"comments":{"href":"https://api.github.com/repos/googlemaps/android-maps-utils/issues/286/comments"},"review_comments":{"href":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/286/comments"},"review_comment":{"href":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/googlemaps/android-maps-utils/pulls/286/commits"},"statuses":{"href":"https://api.github.com/repos/googlemaps/android-maps-utils/statuses/d40765ea69996dac3af4158b1267f5e753973fe3"}}}}
{"actor":{"display_login":"markmcd"}}