{"action":"created","comment":{"url":"https://api.github.com/repos/fbocharov/au-java/pulls/comments/57699478","id":57699478,"diff_hunk":"@@ -0,0 +1,92 @@\n+package ru.spbau.bocharov.FunctionalJava;\n+\n+import org.junit.Test;\n+\n+import java.util.*;\n+\n+import static org.junit.Assert.*;\n+\n+public class CollectionsTest {\n+\n+    @Test\n+    public void testMap() throws Exception {\n+        assertEquals(Collections.map(id, emptyCollection), emptyCollection);\n+        assertEquals(Collections.map(id, collection10Elements), collection10Elements);\n+\n+        Function1<Integer, Integer> sqr = (arg -> (int) Math.pow(arg, 2));\n+        assertEquals(Collections.map(sqr, collection10Elements), makeSquares(10));\n+    }\n+\n+    @Test\n+    public void testFilter() throws Exception {\n+        assertEquals(Collections.filter(Predicate.ALWAYS_FALSE, collection10Elements), emptyCollection);\n+        assertEquals(Collections.filter(Predicate.ALWAYS_TRUE, collection10Elements), collection10Elements);\n+\n+        Predicate<Integer> p = (arg -> arg < 5);\n+        assertEquals(Collections.filter(p, collection10Elements), makeIntegers(5));\n+    }\n+\n+    @Test\n+    public void testTakeWhile() throws Exception {\n+        assertEquals(Collections.takeWhile(Predicate.ALWAYS_FALSE, emptyCollection), emptyCollection);\n+        assertEquals(Collections.takeWhile(Predicate.ALWAYS_FALSE, collection10Elements), emptyCollection);\n+        assertEquals(Collections.takeWhile(Predicate.ALWAYS_TRUE, collection10Elements), collection10Elements);\n+\n+        Predicate<Integer> p = (arg -> (arg + 1) % 7 != 0);\n+        assertEquals(Collections.takeWhile(p, collection10Elements), makeIntegers(6));\n+    }\n+\n+    @Test\n+    public void testTakeUnless() throws Exception {\n+        assertEquals(Collections.takeUnless(Predicate.ALWAYS_FALSE, emptyCollection), emptyCollection);\n+        assertEquals(Collections.takeUnless(Predicate.ALWAYS_FALSE, collection10Elements), collection10Elements);\n+        assertEquals(Collections.takeUnless(Predicate.ALWAYS_TRUE, collection10Elements), emptyCollection);\n+\n+        Predicate<Integer> p = (arg -> arg > 4);\n+        assertEquals(Collections.takeUnless(p, collection10Elements), makeIntegers(5));\n+    }\n+\n+    @Test\n+    public void testFoldr() throws Exception {\n+        Function2<Integer, Integer, Integer> sum = ((arg1, arg2) -> arg1 + arg2);\n+        assertTrue(45 == Collections.foldr(sum, 0, collection10Elements));\n+\n+        Function2<Integer, Boolean, Boolean> less10 = ((arg, p) -> p && arg < 10);\n+        assertTrue(Collections.foldr(less10, true, collection10Elements));\n+\n+        Function2<Integer, Boolean, Boolean> has8 = ((arg, p) -> p || arg == 8);\n+        assertTrue(Collections.foldr(has8, false, collection10Elements));\n+    }\n+\n+    @Test\n+    public void testFoldl() throws Exception {\n+        Function2<Integer, Integer, Integer> sum = ((arg1, arg2) -> arg1 + arg2);\n+        assertTrue(45 == Collections.foldr(sum, 0, collection10Elements));","path":"hw/FunctionalJava/src/test/java/ru/spbau/bocharov/FunctionalJava/CollectionsTest.java","position":64,"original_position":64,"commit_id":"88017de512f5d72395f5ac31ee13bb9d81133877","original_commit_id":"88017de512f5d72395f5ac31ee13bb9d81133877","user":{"login":"sproshev","id":4990763,"avatar_url":"https://avatars.githubusercontent.com/u/4990763?v=3","gravatar_id":"","url":"https://api.github.com/users/sproshev","html_url":"https://github.com/sproshev","followers_url":"https://api.github.com/users/sproshev/followers","following_url":"https://api.github.com/users/sproshev/following{/other_user}","gists_url":"https://api.github.com/users/sproshev/gists{/gist_id}","starred_url":"https://api.github.com/users/sproshev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sproshev/subscriptions","organizations_url":"https://api.github.com/users/sproshev/orgs","repos_url":"https://api.github.com/users/sproshev/repos","events_url":"https://api.github.com/users/sproshev/events{/privacy}","received_events_url":"https://api.github.com/users/sproshev/received_events","type":"User","site_admin":false},"body":"asEq","created_at":"2016-03-29T10:06:38Z","updated_at":"2016-03-29T10:06:38Z","html_url":"https://github.com/fbocharov/au-java/pull/3#discussion_r57699478","pull_request_url":"https://api.github.com/repos/fbocharov/au-java/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/fbocharov/au-java/pulls/comments/57699478"},"html":{"href":"https://github.com/fbocharov/au-java/pull/3#discussion_r57699478"},"pull_request":{"href":"https://api.github.com/repos/fbocharov/au-java/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/fbocharov/au-java/pulls/3","id":63429265,"html_url":"https://github.com/fbocharov/au-java/pull/3","diff_url":"https://github.com/fbocharov/au-java/pull/3.diff","patch_url":"https://github.com/fbocharov/au-java/pull/3.patch","issue_url":"https://api.github.com/repos/fbocharov/au-java/issues/3","number":3,"state":"open","locked":false,"title":"Java05. ДЗ 03, Федор Бочаров","user":{"login":"fbocharov","id":4655777,"avatar_url":"https://avatars.githubusercontent.com/u/4655777?v=3","gravatar_id":"","url":"https://api.github.com/users/fbocharov","html_url":"https://github.com/fbocharov","followers_url":"https://api.github.com/users/fbocharov/followers","following_url":"https://api.github.com/users/fbocharov/following{/other_user}","gists_url":"https://api.github.com/users/fbocharov/gists{/gist_id}","starred_url":"https://api.github.com/users/fbocharov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fbocharov/subscriptions","organizations_url":"https://api.github.com/users/fbocharov/orgs","repos_url":"https://api.github.com/users/fbocharov/repos","events_url":"https://api.github.com/users/fbocharov/events{/privacy}","received_events_url":"https://api.github.com/users/fbocharov/received_events","type":"User","site_admin":false},"body":"@sproshev, review this, please","created_at":"2016-03-18T20:06:55Z","updated_at":"2016-03-29T10:06:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ef440b840fd29f2f7cfa6c52ff78292bba462624","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fbocharov/au-java/pulls/3/commits","review_comments_url":"https://api.github.com/repos/fbocharov/au-java/pulls/3/comments","review_comment_url":"https://api.github.com/repos/fbocharov/au-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fbocharov/au-java/issues/3/comments","statuses_url":"https://api.github.com/repos/fbocharov/au-java/statuses/88017de512f5d72395f5ac31ee13bb9d81133877","head":{"label":"fbocharov:hw03","ref":"hw03","sha":"88017de512f5d72395f5ac31ee13bb9d81133877","user":{"login":"fbocharov","id":4655777,"avatar_url":"https://avatars.githubusercontent.com/u/4655777?v=3","gravatar_id":"","url":"https://api.github.com/users/fbocharov","html_url":"https://github.com/fbocharov","followers_url":"https://api.github.com/users/fbocharov/followers","following_url":"https://api.github.com/users/fbocharov/following{/other_user}","gists_url":"https://api.github.com/users/fbocharov/gists{/gist_id}","starred_url":"https://api.github.com/users/fbocharov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fbocharov/subscriptions","organizations_url":"https://api.github.com/users/fbocharov/orgs","repos_url":"https://api.github.com/users/fbocharov/repos","events_url":"https://api.github.com/users/fbocharov/events{/privacy}","received_events_url":"https://api.github.com/users/fbocharov/received_events","type":"User","site_admin":false},"repo":{"id":51925815,"name":"au-java","full_name":"fbocharov/au-java","owner":{"login":"fbocharov","id":4655777,"avatar_url":"https://avatars.githubusercontent.com/u/4655777?v=3","gravatar_id":"","url":"https://api.github.com/users/fbocharov","html_url":"https://github.com/fbocharov","followers_url":"https://api.github.com/users/fbocharov/followers","following_url":"https://api.github.com/users/fbocharov/following{/other_user}","gists_url":"https://api.github.com/users/fbocharov/gists{/gist_id}","starred_url":"https://api.github.com/users/fbocharov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fbocharov/subscriptions","organizations_url":"https://api.github.com/users/fbocharov/orgs","repos_url":"https://api.github.com/users/fbocharov/repos","events_url":"https://api.github.com/users/fbocharov/events{/privacy}","received_events_url":"https://api.github.com/users/fbocharov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fbocharov/au-java","description":"Homeworks for Java language course in SPbAU.","fork":false,"url":"https://api.github.com/repos/fbocharov/au-java","forks_url":"https://api.github.com/repos/fbocharov/au-java/forks","keys_url":"https://api.github.com/repos/fbocharov/au-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fbocharov/au-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fbocharov/au-java/teams","hooks_url":"https://api.github.com/repos/fbocharov/au-java/hooks","issue_events_url":"https://api.github.com/repos/fbocharov/au-java/issues/events{/number}","events_url":"https://api.github.com/repos/fbocharov/au-java/events","assignees_url":"https://api.github.com/repos/fbocharov/au-java/assignees{/user}","branches_url":"https://api.github.com/repos/fbocharov/au-java/branches{/branch}","tags_url":"https://api.github.com/repos/fbocharov/au-java/tags","blobs_url":"https://api.github.com/repos/fbocharov/au-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fbocharov/au-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fbocharov/au-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/fbocharov/au-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fbocharov/au-java/statuses/{sha}","languages_url":"https://api.github.com/repos/fbocharov/au-java/languages","stargazers_url":"https://api.github.com/repos/fbocharov/au-java/stargazers","contributors_url":"https://api.github.com/repos/fbocharov/au-java/contributors","subscribers_url":"https://api.github.com/repos/fbocharov/au-java/subscribers","subscription_url":"https://api.github.com/repos/fbocharov/au-java/subscription","commits_url":"https://api.github.com/repos/fbocharov/au-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/fbocharov/au-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/fbocharov/au-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/fbocharov/au-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/fbocharov/au-java/contents/{+path}","compare_url":"https://api.github.com/repos/fbocharov/au-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fbocharov/au-java/merges","archive_url":"https://api.github.com/repos/fbocharov/au-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fbocharov/au-java/downloads","issues_url":"https://api.github.com/repos/fbocharov/au-java/issues{/number}","pulls_url":"https://api.github.com/repos/fbocharov/au-java/pulls{/number}","milestones_url":"https://api.github.com/repos/fbocharov/au-java/milestones{/number}","notifications_url":"https://api.github.com/repos/fbocharov/au-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fbocharov/au-java/labels{/name}","releases_url":"https://api.github.com/repos/fbocharov/au-java/releases{/id}","deployments_url":"https://api.github.com/repos/fbocharov/au-java/deployments","created_at":"2016-02-17T13:49:17Z","updated_at":"2016-02-17T13:49:17Z","pushed_at":"2016-03-18T20:06:55Z","git_url":"git://github.com/fbocharov/au-java.git","ssh_url":"git@github.com:fbocharov/au-java.git","clone_url":"https://github.com/fbocharov/au-java.git","svn_url":"https://github.com/fbocharov/au-java","homepage":null,"size":19,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"fbocharov:master","ref":"master","sha":"0224a5c364bf040c8fe9cae0ea068423e93dc60b","user":{"login":"fbocharov","id":4655777,"avatar_url":"https://avatars.githubusercontent.com/u/4655777?v=3","gravatar_id":"","url":"https://api.github.com/users/fbocharov","html_url":"https://github.com/fbocharov","followers_url":"https://api.github.com/users/fbocharov/followers","following_url":"https://api.github.com/users/fbocharov/following{/other_user}","gists_url":"https://api.github.com/users/fbocharov/gists{/gist_id}","starred_url":"https://api.github.com/users/fbocharov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fbocharov/subscriptions","organizations_url":"https://api.github.com/users/fbocharov/orgs","repos_url":"https://api.github.com/users/fbocharov/repos","events_url":"https://api.github.com/users/fbocharov/events{/privacy}","received_events_url":"https://api.github.com/users/fbocharov/received_events","type":"User","site_admin":false},"repo":{"id":51925815,"name":"au-java","full_name":"fbocharov/au-java","owner":{"login":"fbocharov","id":4655777,"avatar_url":"https://avatars.githubusercontent.com/u/4655777?v=3","gravatar_id":"","url":"https://api.github.com/users/fbocharov","html_url":"https://github.com/fbocharov","followers_url":"https://api.github.com/users/fbocharov/followers","following_url":"https://api.github.com/users/fbocharov/following{/other_user}","gists_url":"https://api.github.com/users/fbocharov/gists{/gist_id}","starred_url":"https://api.github.com/users/fbocharov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fbocharov/subscriptions","organizations_url":"https://api.github.com/users/fbocharov/orgs","repos_url":"https://api.github.com/users/fbocharov/repos","events_url":"https://api.github.com/users/fbocharov/events{/privacy}","received_events_url":"https://api.github.com/users/fbocharov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fbocharov/au-java","description":"Homeworks for Java language course in SPbAU.","fork":false,"url":"https://api.github.com/repos/fbocharov/au-java","forks_url":"https://api.github.com/repos/fbocharov/au-java/forks","keys_url":"https://api.github.com/repos/fbocharov/au-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fbocharov/au-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fbocharov/au-java/teams","hooks_url":"https://api.github.com/repos/fbocharov/au-java/hooks","issue_events_url":"https://api.github.com/repos/fbocharov/au-java/issues/events{/number}","events_url":"https://api.github.com/repos/fbocharov/au-java/events","assignees_url":"https://api.github.com/repos/fbocharov/au-java/assignees{/user}","branches_url":"https://api.github.com/repos/fbocharov/au-java/branches{/branch}","tags_url":"https://api.github.com/repos/fbocharov/au-java/tags","blobs_url":"https://api.github.com/repos/fbocharov/au-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fbocharov/au-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fbocharov/au-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/fbocharov/au-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fbocharov/au-java/statuses/{sha}","languages_url":"https://api.github.com/repos/fbocharov/au-java/languages","stargazers_url":"https://api.github.com/repos/fbocharov/au-java/stargazers","contributors_url":"https://api.github.com/repos/fbocharov/au-java/contributors","subscribers_url":"https://api.github.com/repos/fbocharov/au-java/subscribers","subscription_url":"https://api.github.com/repos/fbocharov/au-java/subscription","commits_url":"https://api.github.com/repos/fbocharov/au-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/fbocharov/au-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/fbocharov/au-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/fbocharov/au-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/fbocharov/au-java/contents/{+path}","compare_url":"https://api.github.com/repos/fbocharov/au-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fbocharov/au-java/merges","archive_url":"https://api.github.com/repos/fbocharov/au-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fbocharov/au-java/downloads","issues_url":"https://api.github.com/repos/fbocharov/au-java/issues{/number}","pulls_url":"https://api.github.com/repos/fbocharov/au-java/pulls{/number}","milestones_url":"https://api.github.com/repos/fbocharov/au-java/milestones{/number}","notifications_url":"https://api.github.com/repos/fbocharov/au-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fbocharov/au-java/labels{/name}","releases_url":"https://api.github.com/repos/fbocharov/au-java/releases{/id}","deployments_url":"https://api.github.com/repos/fbocharov/au-java/deployments","created_at":"2016-02-17T13:49:17Z","updated_at":"2016-02-17T13:49:17Z","pushed_at":"2016-03-18T20:06:55Z","git_url":"git://github.com/fbocharov/au-java.git","ssh_url":"git@github.com:fbocharov/au-java.git","clone_url":"https://github.com/fbocharov/au-java.git","svn_url":"https://github.com/fbocharov/au-java","homepage":null,"size":19,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fbocharov/au-java/pulls/3"},"html":{"href":"https://github.com/fbocharov/au-java/pull/3"},"issue":{"href":"https://api.github.com/repos/fbocharov/au-java/issues/3"},"comments":{"href":"https://api.github.com/repos/fbocharov/au-java/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/fbocharov/au-java/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/fbocharov/au-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fbocharov/au-java/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/fbocharov/au-java/statuses/88017de512f5d72395f5ac31ee13bb9d81133877"}}}}