{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/34904874","id":34904874,"diff_hunk":"@@ -0,0 +1,164 @@\n+/*\n+ * Copyright (C) 2015 Typesafe Inc. <http://www.typesafe.com>\n+ */\n+\n+package docs.stream;\n+\n+import java.util.ArrayList;\n+import java.util.Collections;\n+import java.util.List;\n+import java.util.concurrent.TimeUnit;\n+import java.util.stream.DoubleStream;\n+\n+import org.junit.AfterClass;\n+import org.junit.BeforeClass;\n+import org.junit.Test;\n+import static org.junit.Assert.*;\n+\n+import akka.actor.ActorSystem;\n+import akka.japi.Pair;\n+import akka.japi.tuple.Tuple3;\n+import akka.stream.*;\n+import akka.stream.javadsl.*;\n+import akka.stream.testkit.TestPublisher;\n+import akka.stream.testkit.TestSubscriber;\n+import akka.stream.testkit.javadsl.TestSink;\n+import akka.stream.testkit.javadsl.TestSource;\n+import akka.testkit.JavaTestKit;\n+import scala.collection.Iterator;\n+import scala.concurrent.Await;\n+import scala.concurrent.Future;\n+import scala.concurrent.duration.Duration;\n+import scala.runtime.BoxedUnit;\n+import scala.util.Random;\n+\n+public class RateTransformationDocTest {\n+\n+  private static ActorSystem system;\n+\n+  @BeforeClass\n+  public static void setup() {\n+    system = ActorSystem.create(\"RateTransformationDocTest\");\n+  }\n+\n+  @AfterClass\n+  public static void tearDown() {\n+    JavaTestKit.shutdownActorSystem(system);\n+    system = null;\n+  }\n+\n+  final Materializer mat = ActorMaterializer.create(system);\n+\n+  final Random r = new Random();\n+\n+  @Test\n+  public void conflateShouldSummarize() throws Exception {\n+    //#conflate-summarize\n+    final Flow<Double, Tuple3<Double, Double, Integer>, BoxedUnit> statsFlow =\n+      Flow.of(Double.class)\n+        .conflate(elem -> {\n+          return new ArrayList<Double>() {\n+            {\n+              this.add(elem);\n+            }\n+          };\n+        } , (acc, elem) -> {\n+          acc.add(elem);\n+          return acc;\n+        })\n+        .map(s -> {\n+          final Double mean = s.stream().mapToDouble(d -> d).sum() / s.size();\n+          final DoubleStream se = s.stream().mapToDouble(x -> Math.pow(x - mean, 2));\n+          final Double stdDev = Math.sqrt(se.sum() / s.size());\n+          return new Tuple3(stdDev, mean, s.size());","path":"akka-samples/akka-docs-java-lambda/src/test/java/docs/stream/RateTransformationDocTest.java","position":73,"original_position":73,"commit_id":"923f59fdc6d1388efbdcb1daebef8d181788e24b","original_commit_id":"923f59fdc6d1388efbdcb1daebef8d181788e24b","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"body":"Just thought that we should provide\r\n\r\n```\r\nclass Tuple {\r\n  public statc Tuple3 of(...);\r\n}\r\n```\r\n\r\nI'd love that.\r\n\r\n // separate issue","created_at":"2015-07-17T16:16:42Z","updated_at":"2015-07-17T16:16:42Z","html_url":"https://github.com/akka/akka/pull/18024#discussion_r34904874","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/18024","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/34904874"},"html":{"href":"https://github.com/akka/akka/pull/18024#discussion_r34904874"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/18024"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/18024","id":40234151,"html_url":"https://github.com/akka/akka/pull/18024","diff_url":"https://github.com/akka/akka/pull/18024.diff","patch_url":"https://github.com/akka/akka/pull/18024.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/18024","number":18024,"state":"open","locked":false,"title":"=doc #18012 rate transformation docs","user":{"login":"2m","id":422086,"avatar_url":"https://avatars.githubusercontent.com/u/422086?v=3","gravatar_id":"","url":"https://api.github.com/users/2m","html_url":"https://github.com/2m","followers_url":"https://api.github.com/users/2m/followers","following_url":"https://api.github.com/users/2m/following{/other_user}","gists_url":"https://api.github.com/users/2m/gists{/gist_id}","starred_url":"https://api.github.com/users/2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2m/subscriptions","organizations_url":"https://api.github.com/users/2m/orgs","repos_url":"https://api.github.com/users/2m/repos","events_url":"https://api.github.com/users/2m/events{/privacy}","received_events_url":"https://api.github.com/users/2m/received_events","type":"User","site_admin":false},"body":"Refs #18012","created_at":"2015-07-17T14:05:18Z","updated_at":"2015-07-17T16:16:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea98e56b6114983d5fe931a69d2468416ac88a70","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/18024/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/18024/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka/issues/18024/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/923f59fdc6d1388efbdcb1daebef8d181788e24b","head":{"label":"2m:wip-18012-rate-transformation-docs-2m","ref":"wip-18012-rate-transformation-docs-2m","sha":"923f59fdc6d1388efbdcb1daebef8d181788e24b","user":{"login":"2m","id":422086,"avatar_url":"https://avatars.githubusercontent.com/u/422086?v=3","gravatar_id":"","url":"https://api.github.com/users/2m","html_url":"https://github.com/2m","followers_url":"https://api.github.com/users/2m/followers","following_url":"https://api.github.com/users/2m/following{/other_user}","gists_url":"https://api.github.com/users/2m/gists{/gist_id}","starred_url":"https://api.github.com/users/2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2m/subscriptions","organizations_url":"https://api.github.com/users/2m/orgs","repos_url":"https://api.github.com/users/2m/repos","events_url":"https://api.github.com/users/2m/events{/privacy}","received_events_url":"https://api.github.com/users/2m/received_events","type":"User","site_admin":false},"repo":{"id":18794399,"name":"akka","full_name":"2m/akka","owner":{"login":"2m","id":422086,"avatar_url":"https://avatars.githubusercontent.com/u/422086?v=3","gravatar_id":"","url":"https://api.github.com/users/2m","html_url":"https://github.com/2m","followers_url":"https://api.github.com/users/2m/followers","following_url":"https://api.github.com/users/2m/following{/other_user}","gists_url":"https://api.github.com/users/2m/gists{/gist_id}","starred_url":"https://api.github.com/users/2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2m/subscriptions","organizations_url":"https://api.github.com/users/2m/orgs","repos_url":"https://api.github.com/users/2m/repos","events_url":"https://api.github.com/users/2m/events{/privacy}","received_events_url":"https://api.github.com/users/2m/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/2m/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/2m/akka","forks_url":"https://api.github.com/repos/2m/akka/forks","keys_url":"https://api.github.com/repos/2m/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/2m/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/2m/akka/teams","hooks_url":"https://api.github.com/repos/2m/akka/hooks","issue_events_url":"https://api.github.com/repos/2m/akka/issues/events{/number}","events_url":"https://api.github.com/repos/2m/akka/events","assignees_url":"https://api.github.com/repos/2m/akka/assignees{/user}","branches_url":"https://api.github.com/repos/2m/akka/branches{/branch}","tags_url":"https://api.github.com/repos/2m/akka/tags","blobs_url":"https://api.github.com/repos/2m/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/2m/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/2m/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/2m/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/2m/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/2m/akka/languages","stargazers_url":"https://api.github.com/repos/2m/akka/stargazers","contributors_url":"https://api.github.com/repos/2m/akka/contributors","subscribers_url":"https://api.github.com/repos/2m/akka/subscribers","subscription_url":"https://api.github.com/repos/2m/akka/subscription","commits_url":"https://api.github.com/repos/2m/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/2m/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/2m/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/2m/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/2m/akka/contents/{+path}","compare_url":"https://api.github.com/repos/2m/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/2m/akka/merges","archive_url":"https://api.github.com/repos/2m/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/2m/akka/downloads","issues_url":"https://api.github.com/repos/2m/akka/issues{/number}","pulls_url":"https://api.github.com/repos/2m/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/2m/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/2m/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/2m/akka/labels{/name}","releases_url":"https://api.github.com/repos/2m/akka/releases{/id}","created_at":"2014-04-15T09:23:35Z","updated_at":"2015-02-04T11:32:40Z","pushed_at":"2015-07-17T14:03:54Z","git_url":"git://github.com/2m/akka.git","ssh_url":"git@github.com:2m/akka.git","clone_url":"https://github.com/2m/akka.git","svn_url":"https://github.com/2m/akka","homepage":"http://akka.io","size":163925,"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:release-2.3-dev","ref":"release-2.3-dev","sha":"60bf9f30cd70803a5c5ac21aa838f45d9a528a12","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":"2015-07-16T22:03:25Z","pushed_at":"2015-07-17T15:53:23Z","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":263923,"stargazers_count":4221,"watchers_count":4221,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1228,"mirror_url":null,"open_issues_count":681,"forks":1228,"open_issues":681,"watchers":4221,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/18024"},"html":{"href":"https://github.com/akka/akka/pull/18024"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/18024"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/18024/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/18024/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/18024/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/923f59fdc6d1388efbdcb1daebef8d181788e24b"}}}}