{"action":"created","comment":{"url":"https://api.github.com/repos/airbnb/epoxy/pulls/comments/80405095","id":80405095,"diff_hunk":"@@ -0,0 +1,38 @@\n+package com.airbnb.epoxy;\n+\n+import com.airbnb.epoxy.ModelList.ModelListObserver;\n+\n+/**\n+ * Listens for changes to the model array list in the adapter, storing and batching insertions and\n+ * removals to that list. This knowledge helps us be more efficient with the differ, avoiding diff\n+ * computations when not necessary and allowing us to take some shortcuts.\n+ * <p>\n+ * This isn't a silver bullet, as users could clear the list and add back the same objects resulting\n+ * in no net change, but this would record a batch removal and batch insert. Thus when we record\n+ * both removals and insertions we still need to run a full diff. However, if the list doesn't\n+ * change, or only changes due to insertions or removals, we can skip doing a full diff.\n+ */\n+class DifferModelListObserver extends UpdateOpHelper implements ModelListObserver {","path":"epoxy-adapter/src/main/java/com/airbnb/epoxy/DifferModelListObserver.java","position":15,"original_position":15,"commit_id":"7d96c5b550105e0664946860be467b6c417327d0","original_commit_id":"7d96c5b550105e0664946860be467b6c417327d0","user":{"login":"elihart","id":2739242,"avatar_url":"https://avatars.githubusercontent.com/u/2739242?v=3","gravatar_id":"","url":"https://api.github.com/users/elihart","html_url":"https://github.com/elihart","followers_url":"https://api.github.com/users/elihart/followers","following_url":"https://api.github.com/users/elihart/following{/other_user}","gists_url":"https://api.github.com/users/elihart/gists{/gist_id}","starred_url":"https://api.github.com/users/elihart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elihart/subscriptions","organizations_url":"https://api.github.com/users/elihart/orgs","repos_url":"https://api.github.com/users/elihart/repos","events_url":"https://api.github.com/users/elihart/events{/privacy}","received_events_url":"https://api.github.com/users/elihart/received_events","type":"User","site_admin":false},"body":"This leverages the previous work I did on the `UpdateOpHelper`, which makes batching list changes easy.","created_at":"2016-09-26T03:54:08Z","updated_at":"2016-09-26T03:55:17Z","html_url":"https://github.com/airbnb/epoxy/pull/52#discussion_r80405095","pull_request_url":"https://api.github.com/repos/airbnb/epoxy/pulls/52","_links":{"self":{"href":"https://api.github.com/repos/airbnb/epoxy/pulls/comments/80405095"},"html":{"href":"https://github.com/airbnb/epoxy/pull/52#discussion_r80405095"},"pull_request":{"href":"https://api.github.com/repos/airbnb/epoxy/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/airbnb/epoxy/pulls/52","id":86662536,"html_url":"https://github.com/airbnb/epoxy/pull/52","diff_url":"https://github.com/airbnb/epoxy/pull/52.diff","patch_url":"https://github.com/airbnb/epoxy/pull/52.patch","issue_url":"https://api.github.com/repos/airbnb/epoxy/issues/52","number":52,"state":"open","locked":false,"title":"Custom arraylist that reports model changes","user":{"login":"elihart","id":2739242,"avatar_url":"https://avatars.githubusercontent.com/u/2739242?v=3","gravatar_id":"","url":"https://api.github.com/users/elihart","html_url":"https://github.com/elihart","followers_url":"https://api.github.com/users/elihart/followers","following_url":"https://api.github.com/users/elihart/following{/other_user}","gists_url":"https://api.github.com/users/elihart/gists{/gist_id}","starred_url":"https://api.github.com/users/elihart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elihart/subscriptions","organizations_url":"https://api.github.com/users/elihart/orgs","repos_url":"https://api.github.com/users/elihart/repos","events_url":"https://api.github.com/users/elihart/events{/privacy}","received_events_url":"https://api.github.com/users/elihart/received_events","type":"User","site_admin":false},"body":"This creates a ModelList class that extends ArrayList and notifies a listener whenever something is added or removed from the list. A listener in the diff helper uses this information to optimize diffing.\r\n\r\nThis makes the differ quite a bit faster if no changes have been done to the list, or if just adds or just removes were done, since moves don't need to be checked. This will also be more memory efficient since it isn't creating new state objects for each model.\r\n\r\nWith changes:\r\n<img width=\"237\" alt=\"list_test_changes\" src=\"https://cloud.githubusercontent.com/assets/2739242/18822152/ab152638-8361-11e6-97f7-28b1c4a21e5a.png\">\r\n\r\nBefore changes:\r\n<img width=\"237\" alt=\"list_test_master\" src=\"https://cloud.githubusercontent.com/assets/2739242/18822153/ab15af36-8361-11e6-85e8-cc6de520d549.png\">\r\n\r\n","created_at":"2016-09-25T21:01:00Z","updated_at":"2016-09-26T03:55:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"715ee8225cdad78ae1e020d67fd5a608e27cd733","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/airbnb/epoxy/pulls/52/commits","review_comments_url":"https://api.github.com/repos/airbnb/epoxy/pulls/52/comments","review_comment_url":"https://api.github.com/repos/airbnb/epoxy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/airbnb/epoxy/issues/52/comments","statuses_url":"https://api.github.com/repos/airbnb/epoxy/statuses/7d96c5b550105e0664946860be467b6c417327d0","head":{"label":"airbnb:eli/notifying_list","ref":"eli/notifying_list","sha":"7d96c5b550105e0664946860be467b6c417327d0","user":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"repo":{"id":65245890,"name":"epoxy","full_name":"airbnb/epoxy","owner":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/airbnb/epoxy","description":"Epoxy is an Android library for building complex screens in a RecyclerView","fork":false,"url":"https://api.github.com/repos/airbnb/epoxy","forks_url":"https://api.github.com/repos/airbnb/epoxy/forks","keys_url":"https://api.github.com/repos/airbnb/epoxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/airbnb/epoxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/airbnb/epoxy/teams","hooks_url":"https://api.github.com/repos/airbnb/epoxy/hooks","issue_events_url":"https://api.github.com/repos/airbnb/epoxy/issues/events{/number}","events_url":"https://api.github.com/repos/airbnb/epoxy/events","assignees_url":"https://api.github.com/repos/airbnb/epoxy/assignees{/user}","branches_url":"https://api.github.com/repos/airbnb/epoxy/branches{/branch}","tags_url":"https://api.github.com/repos/airbnb/epoxy/tags","blobs_url":"https://api.github.com/repos/airbnb/epoxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/airbnb/epoxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/airbnb/epoxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/airbnb/epoxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/airbnb/epoxy/statuses/{sha}","languages_url":"https://api.github.com/repos/airbnb/epoxy/languages","stargazers_url":"https://api.github.com/repos/airbnb/epoxy/stargazers","contributors_url":"https://api.github.com/repos/airbnb/epoxy/contributors","subscribers_url":"https://api.github.com/repos/airbnb/epoxy/subscribers","subscription_url":"https://api.github.com/repos/airbnb/epoxy/subscription","commits_url":"https://api.github.com/repos/airbnb/epoxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/airbnb/epoxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/airbnb/epoxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/airbnb/epoxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/airbnb/epoxy/contents/{+path}","compare_url":"https://api.github.com/repos/airbnb/epoxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/airbnb/epoxy/merges","archive_url":"https://api.github.com/repos/airbnb/epoxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/airbnb/epoxy/downloads","issues_url":"https://api.github.com/repos/airbnb/epoxy/issues{/number}","pulls_url":"https://api.github.com/repos/airbnb/epoxy/pulls{/number}","milestones_url":"https://api.github.com/repos/airbnb/epoxy/milestones{/number}","notifications_url":"https://api.github.com/repos/airbnb/epoxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/airbnb/epoxy/labels{/name}","releases_url":"https://api.github.com/repos/airbnb/epoxy/releases{/id}","deployments_url":"https://api.github.com/repos/airbnb/epoxy/deployments","created_at":"2016-08-08T23:05:11Z","updated_at":"2016-09-26T01:38:20Z","pushed_at":"2016-09-25T21:01:00Z","git_url":"git://github.com/airbnb/epoxy.git","ssh_url":"git@github.com:airbnb/epoxy.git","clone_url":"https://github.com/airbnb/epoxy.git","svn_url":"https://github.com/airbnb/epoxy","homepage":"","size":2336,"stargazers_count":822,"watchers_count":822,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":46,"mirror_url":null,"open_issues_count":9,"forks":46,"open_issues":9,"watchers":822,"default_branch":"master"}},"base":{"label":"airbnb:master","ref":"master","sha":"6252120542b9be7a111352cf1dd5fefb3647c44a","user":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"repo":{"id":65245890,"name":"epoxy","full_name":"airbnb/epoxy","owner":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/airbnb/epoxy","description":"Epoxy is an Android library for building complex screens in a RecyclerView","fork":false,"url":"https://api.github.com/repos/airbnb/epoxy","forks_url":"https://api.github.com/repos/airbnb/epoxy/forks","keys_url":"https://api.github.com/repos/airbnb/epoxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/airbnb/epoxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/airbnb/epoxy/teams","hooks_url":"https://api.github.com/repos/airbnb/epoxy/hooks","issue_events_url":"https://api.github.com/repos/airbnb/epoxy/issues/events{/number}","events_url":"https://api.github.com/repos/airbnb/epoxy/events","assignees_url":"https://api.github.com/repos/airbnb/epoxy/assignees{/user}","branches_url":"https://api.github.com/repos/airbnb/epoxy/branches{/branch}","tags_url":"https://api.github.com/repos/airbnb/epoxy/tags","blobs_url":"https://api.github.com/repos/airbnb/epoxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/airbnb/epoxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/airbnb/epoxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/airbnb/epoxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/airbnb/epoxy/statuses/{sha}","languages_url":"https://api.github.com/repos/airbnb/epoxy/languages","stargazers_url":"https://api.github.com/repos/airbnb/epoxy/stargazers","contributors_url":"https://api.github.com/repos/airbnb/epoxy/contributors","subscribers_url":"https://api.github.com/repos/airbnb/epoxy/subscribers","subscription_url":"https://api.github.com/repos/airbnb/epoxy/subscription","commits_url":"https://api.github.com/repos/airbnb/epoxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/airbnb/epoxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/airbnb/epoxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/airbnb/epoxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/airbnb/epoxy/contents/{+path}","compare_url":"https://api.github.com/repos/airbnb/epoxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/airbnb/epoxy/merges","archive_url":"https://api.github.com/repos/airbnb/epoxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/airbnb/epoxy/downloads","issues_url":"https://api.github.com/repos/airbnb/epoxy/issues{/number}","pulls_url":"https://api.github.com/repos/airbnb/epoxy/pulls{/number}","milestones_url":"https://api.github.com/repos/airbnb/epoxy/milestones{/number}","notifications_url":"https://api.github.com/repos/airbnb/epoxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/airbnb/epoxy/labels{/name}","releases_url":"https://api.github.com/repos/airbnb/epoxy/releases{/id}","deployments_url":"https://api.github.com/repos/airbnb/epoxy/deployments","created_at":"2016-08-08T23:05:11Z","updated_at":"2016-09-26T01:38:20Z","pushed_at":"2016-09-25T21:01:00Z","git_url":"git://github.com/airbnb/epoxy.git","ssh_url":"git@github.com:airbnb/epoxy.git","clone_url":"https://github.com/airbnb/epoxy.git","svn_url":"https://github.com/airbnb/epoxy","homepage":"","size":2336,"stargazers_count":822,"watchers_count":822,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":46,"mirror_url":null,"open_issues_count":9,"forks":46,"open_issues":9,"watchers":822,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/airbnb/epoxy/pulls/52"},"html":{"href":"https://github.com/airbnb/epoxy/pull/52"},"issue":{"href":"https://api.github.com/repos/airbnb/epoxy/issues/52"},"comments":{"href":"https://api.github.com/repos/airbnb/epoxy/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/airbnb/epoxy/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/airbnb/epoxy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/airbnb/epoxy/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/airbnb/epoxy/statuses/7d96c5b550105e0664946860be467b6c417327d0"}}}}
{"actor":{"display_login":"elihart"}}