{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/49943409","id":49943409,"diff_hunk":"@@ -51,12 +51,14 @@ public void work() throws Exception {\n \n         //#word-count\n         final int MAXIMUM_DISTINCT_WORDS = 1000;\n-        \n+\n         final Source<Pair<String, Integer>, BoxedUnit> counts = words\n-            // split the words into separate streams first\n+          // split the words into separate streams first\n           .groupBy(MAXIMUM_DISTINCT_WORDS, i -> i)\n+          //transform each element to pair with number of words in it\n+          .map(i -> new Pair<String, Integer>(i, 1))\n           // add counting logic to the streams\n-          .fold(new Pair<>(\"\", 0), (pair, elem) -> new Pair<>(elem, pair.second() + 1))\n+          .<Pair<String, Integer>> reduce((left, right) -> new Pair<>(left.first(), left.second() + right.second()))","path":"akka-docs/rst/java/code/docs/stream/javadsl/cookbook/RecipeReduceByKeyTest.java","position":14,"original_position":14,"commit_id":"488e0f5f78f1486ab1e594b71c9ba08b3b80e686","original_commit_id":"488e0f5f78f1486ab1e594b71c9ba08b3b80e686","user":{"login":"rkuhn","id":470469,"avatar_url":"https://avatars.githubusercontent.com/u/470469?v=3","gravatar_id":"","url":"https://api.github.com/users/rkuhn","html_url":"https://github.com/rkuhn","followers_url":"https://api.github.com/users/rkuhn/followers","following_url":"https://api.github.com/users/rkuhn/following{/other_user}","gists_url":"https://api.github.com/users/rkuhn/gists{/gist_id}","starred_url":"https://api.github.com/users/rkuhn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkuhn/subscriptions","organizations_url":"https://api.github.com/users/rkuhn/orgs","repos_url":"https://api.github.com/users/rkuhn/repos","events_url":"https://api.github.com/users/rkuhn/events{/privacy}","received_events_url":"https://api.github.com/users/rkuhn/received_events","type":"User","site_admin":false},"body":"This type ascription should not be necessary: why is the reduce method generic?","created_at":"2016-01-17T09:04:10Z","updated_at":"2016-01-17T09:04:10Z","html_url":"https://github.com/akka/akka/pull/19485#discussion_r49943409","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/19485","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/49943409"},"html":{"href":"https://github.com/akka/akka/pull/19485#discussion_r49943409"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/19485"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/19485","id":56246072,"html_url":"https://github.com/akka/akka/pull/19485","diff_url":"https://github.com/akka/akka/pull/19485.diff","patch_url":"https://github.com/akka/akka/pull/19485.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/19485","number":19485,"state":"open","locked":false,"title":"Agolubev #19020 reduce combinator","user":{"login":"agolubev","id":461456,"avatar_url":"https://avatars.githubusercontent.com/u/461456?v=3","gravatar_id":"","url":"https://api.github.com/users/agolubev","html_url":"https://github.com/agolubev","followers_url":"https://api.github.com/users/agolubev/followers","following_url":"https://api.github.com/users/agolubev/following{/other_user}","gists_url":"https://api.github.com/users/agolubev/gists{/gist_id}","starred_url":"https://api.github.com/users/agolubev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agolubev/subscriptions","organizations_url":"https://api.github.com/users/agolubev/orgs","repos_url":"https://api.github.com/users/agolubev/repos","events_url":"https://api.github.com/users/agolubev/events{/privacy}","received_events_url":"https://api.github.com/users/agolubev/received_events","type":"User","site_admin":false},"body":"Ref #19020 and ex PR #19365","created_at":"2016-01-16T05:02:37Z","updated_at":"2016-01-17T09:04:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"973b200a7f9a6f449e06118410b3858b7e21440a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/19485/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/19485/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka/issues/19485/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/488e0f5f78f1486ab1e594b71c9ba08b3b80e686","head":{"label":"agolubev:agolubev-#19020-Reduce_combinator","ref":"agolubev-#19020-Reduce_combinator","sha":"488e0f5f78f1486ab1e594b71c9ba08b3b80e686","user":{"login":"agolubev","id":461456,"avatar_url":"https://avatars.githubusercontent.com/u/461456?v=3","gravatar_id":"","url":"https://api.github.com/users/agolubev","html_url":"https://github.com/agolubev","followers_url":"https://api.github.com/users/agolubev/followers","following_url":"https://api.github.com/users/agolubev/following{/other_user}","gists_url":"https://api.github.com/users/agolubev/gists{/gist_id}","starred_url":"https://api.github.com/users/agolubev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agolubev/subscriptions","organizations_url":"https://api.github.com/users/agolubev/orgs","repos_url":"https://api.github.com/users/agolubev/repos","events_url":"https://api.github.com/users/agolubev/events{/privacy}","received_events_url":"https://api.github.com/users/agolubev/received_events","type":"User","site_admin":false},"repo":{"id":35570392,"name":"akka","full_name":"agolubev/akka","owner":{"login":"agolubev","id":461456,"avatar_url":"https://avatars.githubusercontent.com/u/461456?v=3","gravatar_id":"","url":"https://api.github.com/users/agolubev","html_url":"https://github.com/agolubev","followers_url":"https://api.github.com/users/agolubev/followers","following_url":"https://api.github.com/users/agolubev/following{/other_user}","gists_url":"https://api.github.com/users/agolubev/gists{/gist_id}","starred_url":"https://api.github.com/users/agolubev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agolubev/subscriptions","organizations_url":"https://api.github.com/users/agolubev/orgs","repos_url":"https://api.github.com/users/agolubev/repos","events_url":"https://api.github.com/users/agolubev/events{/privacy}","received_events_url":"https://api.github.com/users/agolubev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/agolubev/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/agolubev/akka","forks_url":"https://api.github.com/repos/agolubev/akka/forks","keys_url":"https://api.github.com/repos/agolubev/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/agolubev/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/agolubev/akka/teams","hooks_url":"https://api.github.com/repos/agolubev/akka/hooks","issue_events_url":"https://api.github.com/repos/agolubev/akka/issues/events{/number}","events_url":"https://api.github.com/repos/agolubev/akka/events","assignees_url":"https://api.github.com/repos/agolubev/akka/assignees{/user}","branches_url":"https://api.github.com/repos/agolubev/akka/branches{/branch}","tags_url":"https://api.github.com/repos/agolubev/akka/tags","blobs_url":"https://api.github.com/repos/agolubev/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/agolubev/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/agolubev/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/agolubev/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/agolubev/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/agolubev/akka/languages","stargazers_url":"https://api.github.com/repos/agolubev/akka/stargazers","contributors_url":"https://api.github.com/repos/agolubev/akka/contributors","subscribers_url":"https://api.github.com/repos/agolubev/akka/subscribers","subscription_url":"https://api.github.com/repos/agolubev/akka/subscription","commits_url":"https://api.github.com/repos/agolubev/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/agolubev/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/agolubev/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/agolubev/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/agolubev/akka/contents/{+path}","compare_url":"https://api.github.com/repos/agolubev/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/agolubev/akka/merges","archive_url":"https://api.github.com/repos/agolubev/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/agolubev/akka/downloads","issues_url":"https://api.github.com/repos/agolubev/akka/issues{/number}","pulls_url":"https://api.github.com/repos/agolubev/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/agolubev/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/agolubev/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/agolubev/akka/labels{/name}","releases_url":"https://api.github.com/repos/agolubev/akka/releases{/id}","created_at":"2015-05-13T19:39:33Z","updated_at":"2016-01-15T22:47:18Z","pushed_at":"2016-01-17T05:12:39Z","git_url":"git://github.com/agolubev/akka.git","ssh_url":"git@github.com:agolubev/akka.git","clone_url":"https://github.com/agolubev/akka.git","svn_url":"https://github.com/agolubev/akka","homepage":"http://akka.io","size":172850,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"akka:master","ref":"master","sha":"b21f2ff292bc5820d5d1ec07d5a11103ea9b3bcc","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"name":"akka","full_name":"akka/akka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka","description":"Akka Project","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","created_at":"2009-02-16T12:51:54Z","updated_at":"2016-01-17T07:17:29Z","pushed_at":"2016-01-17T05:13:48Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":181436,"stargazers_count":4974,"watchers_count":4974,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1510,"mirror_url":null,"open_issues_count":852,"forks":1510,"open_issues":852,"watchers":4974,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/19485"},"html":{"href":"https://github.com/akka/akka/pull/19485"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/19485"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/19485/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/19485/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/19485/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/488e0f5f78f1486ab1e594b71c9ba08b3b80e686"}}}}