{"action":"created","comment":{"url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/comments/196568340","pull_request_review_id":130146099,"id":196568340,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjU2ODM0MA==","diff_hunk":"@@ -0,0 +1,158 @@\n+package streams.part2.exercise;\n+\n+import lambda.data.Employee;\n+import lambda.data.JobHistoryEntry;\n+import lambda.data.Person;\n+import org.junit.Test;\n+\n+import java.util.*;\n+import java.util.stream.Collectors;\n+\n+import static java.util.stream.Collectors.*;\n+import static org.junit.Assert.assertEquals;\n+\n+@SuppressWarnings({\"ConstantConditions\", \"unused\"})\n+public class Exercise1 {\n+\n+    @Test\n+    public void calcTotalYearsSpentInEpam() {\n+        List<Employee> employees = getEmployees();\n+\n+        Long hours = employees\n+                .stream()\n+                .flatMap(employee -> employee.getJobHistory().stream())\n+                .filter(jobHistoryEntry -> \"EPAM\".equals(jobHistoryEntry.getEmployer()))\n+                .map(JobHistoryEntry::getDuration)\n+                .map(Integer::longValue)\n+                .reduce((aLong, aLong2) -> aLong + aLong2)\n+                .orElseThrow(RuntimeException::new);\n+\n+        assertEquals(19, hours.longValue());\n+    }\n+\n+    @Test\n+    public void findPersonsWithQaExperience() {\n+        List<Employee> employees = getEmployees();\n+\n+        Set<Person> workedAsQa = employees\n+                .stream()\n+                .filter(employee -> employee\n+                        .getJobHistory()\n+                        .stream()\n+                        .map(JobHistoryEntry::getPosition)\n+                        .collect(toSet())\n+                        .contains(\"QA\"))","path":"src/test/java/streams/part2/exercise/Exercise1.java","position":44,"original_position":44,"commit_id":"0b46f3d423afa0922b3062ee4ecd53b76c126206","original_commit_id":"0b46f3d423afa0922b3062ee4ecd53b76c126206","user":{"login":"shaart","id":17484507,"node_id":"MDQ6VXNlcjE3NDg0NTA3","avatar_url":"https://avatars3.githubusercontent.com/u/17484507?v=4","gravatar_id":"","url":"https://api.github.com/users/shaart","html_url":"https://github.com/shaart","followers_url":"https://api.github.com/users/shaart/followers","following_url":"https://api.github.com/users/shaart/following{/other_user}","gists_url":"https://api.github.com/users/shaart/gists{/gist_id}","starred_url":"https://api.github.com/users/shaart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaart/subscriptions","organizations_url":"https://api.github.com/users/shaart/orgs","repos_url":"https://api.github.com/users/shaart/repos","events_url":"https://api.github.com/users/shaart/events{/privacy}","received_events_url":"https://api.github.com/users/shaart/received_events","type":"User","site_admin":false},"body":"This is very heavy operation (collecting to set for simple \"contains\").\r\nIt's better to use stream's  `.anyMatch(...)` after mapping to `position`.","created_at":"2018-06-19T20:33:58Z","updated_at":"2018-06-19T20:42:05Z","html_url":"https://github.com/elefus/epam-lab-java8-2018-06/pull/194#discussion_r196568340","pull_request_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/194","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/comments/196568340"},"html":{"href":"https://github.com/elefus/epam-lab-java8-2018-06/pull/194#discussion_r196568340"},"pull_request":{"href":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/194"}}},"pull_request":{"url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/194","id":195355085,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1MzU1MDg1","html_url":"https://github.com/elefus/epam-lab-java8-2018-06/pull/194","diff_url":"https://github.com/elefus/epam-lab-java8-2018-06/pull/194.diff","patch_url":"https://github.com/elefus/epam-lab-java8-2018-06/pull/194.patch","issue_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/issues/194","number":194,"state":"open","locked":false,"title":"Streams.part2.exercise1 (Ilinykh)","user":{"login":"IlyasYOY","id":18665585,"node_id":"MDQ6VXNlcjE4NjY1NTg1","avatar_url":"https://avatars1.githubusercontent.com/u/18665585?v=4","gravatar_id":"","url":"https://api.github.com/users/IlyasYOY","html_url":"https://github.com/IlyasYOY","followers_url":"https://api.github.com/users/IlyasYOY/followers","following_url":"https://api.github.com/users/IlyasYOY/following{/other_user}","gists_url":"https://api.github.com/users/IlyasYOY/gists{/gist_id}","starred_url":"https://api.github.com/users/IlyasYOY/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IlyasYOY/subscriptions","organizations_url":"https://api.github.com/users/IlyasYOY/orgs","repos_url":"https://api.github.com/users/IlyasYOY/repos","events_url":"https://api.github.com/users/IlyasYOY/events{/privacy}","received_events_url":"https://api.github.com/users/IlyasYOY/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-17T00:26:24Z","updated_at":"2018-06-19T20:42:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1a01f190f425b801027de39acc78a9752c367d1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":946879587,"node_id":"MDU6TGFiZWw5NDY4Nzk1ODc=","url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/labels/Users%20approved%200/2","name":"Users approved 0/2","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/194/commits","review_comments_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/194/comments","review_comment_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/issues/194/comments","statuses_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/statuses/0b46f3d423afa0922b3062ee4ecd53b76c126206","head":{"label":"IlyasYOY:streams.part2.exercise1","ref":"streams.part2.exercise1","sha":"0b46f3d423afa0922b3062ee4ecd53b76c126206","user":{"login":"IlyasYOY","id":18665585,"node_id":"MDQ6VXNlcjE4NjY1NTg1","avatar_url":"https://avatars1.githubusercontent.com/u/18665585?v=4","gravatar_id":"","url":"https://api.github.com/users/IlyasYOY","html_url":"https://github.com/IlyasYOY","followers_url":"https://api.github.com/users/IlyasYOY/followers","following_url":"https://api.github.com/users/IlyasYOY/following{/other_user}","gists_url":"https://api.github.com/users/IlyasYOY/gists{/gist_id}","starred_url":"https://api.github.com/users/IlyasYOY/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IlyasYOY/subscriptions","organizations_url":"https://api.github.com/users/IlyasYOY/orgs","repos_url":"https://api.github.com/users/IlyasYOY/repos","events_url":"https://api.github.com/users/IlyasYOY/events{/privacy}","received_events_url":"https://api.github.com/users/IlyasYOY/received_events","type":"User","site_admin":false},"repo":{"id":137538981,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc1Mzg5ODE=","name":"epam-lab-java8-2018-06","full_name":"IlyasYOY/epam-lab-java8-2018-06","owner":{"login":"IlyasYOY","id":18665585,"node_id":"MDQ6VXNlcjE4NjY1NTg1","avatar_url":"https://avatars1.githubusercontent.com/u/18665585?v=4","gravatar_id":"","url":"https://api.github.com/users/IlyasYOY","html_url":"https://github.com/IlyasYOY","followers_url":"https://api.github.com/users/IlyasYOY/followers","following_url":"https://api.github.com/users/IlyasYOY/following{/other_user}","gists_url":"https://api.github.com/users/IlyasYOY/gists{/gist_id}","starred_url":"https://api.github.com/users/IlyasYOY/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IlyasYOY/subscriptions","organizations_url":"https://api.github.com/users/IlyasYOY/orgs","repos_url":"https://api.github.com/users/IlyasYOY/repos","events_url":"https://api.github.com/users/IlyasYOY/events{/privacy}","received_events_url":"https://api.github.com/users/IlyasYOY/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/IlyasYOY/epam-lab-java8-2018-06","description":null,"fork":true,"url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06","forks_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/forks","keys_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/teams","hooks_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/hooks","issue_events_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/issues/events{/number}","events_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/events","assignees_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/assignees{/user}","branches_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/branches{/branch}","tags_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/tags","blobs_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/git/refs{/sha}","trees_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/statuses/{sha}","languages_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/languages","stargazers_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/stargazers","contributors_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/contributors","subscribers_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/subscribers","subscription_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/subscription","commits_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/commits{/sha}","git_commits_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/git/commits{/sha}","comments_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/comments{/number}","issue_comment_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/issues/comments{/number}","contents_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/contents/{+path}","compare_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/merges","archive_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/downloads","issues_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/issues{/number}","pulls_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/pulls{/number}","milestones_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/milestones{/number}","notifications_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/labels{/name}","releases_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/releases{/id}","deployments_url":"https://api.github.com/repos/IlyasYOY/epam-lab-java8-2018-06/deployments","created_at":"2018-06-15T23:09:58Z","updated_at":"2018-06-15T23:10:00Z","pushed_at":"2018-06-17T00:25:49Z","git_url":"git://github.com/IlyasYOY/epam-lab-java8-2018-06.git","ssh_url":"git@github.com:IlyasYOY/epam-lab-java8-2018-06.git","clone_url":"https://github.com/IlyasYOY/epam-lab-java8-2018-06.git","svn_url":"https://github.com/IlyasYOY/epam-lab-java8-2018-06","homepage":null,"size":203,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elefus:ilinykh","ref":"ilinykh","sha":"a9e89553aee9159b69182aa23893067a358ab9e1","user":{"login":"elefus","id":15202315,"node_id":"MDQ6VXNlcjE1MjAyMzE1","avatar_url":"https://avatars1.githubusercontent.com/u/15202315?v=4","gravatar_id":"","url":"https://api.github.com/users/elefus","html_url":"https://github.com/elefus","followers_url":"https://api.github.com/users/elefus/followers","following_url":"https://api.github.com/users/elefus/following{/other_user}","gists_url":"https://api.github.com/users/elefus/gists{/gist_id}","starred_url":"https://api.github.com/users/elefus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elefus/subscriptions","organizations_url":"https://api.github.com/users/elefus/orgs","repos_url":"https://api.github.com/users/elefus/repos","events_url":"https://api.github.com/users/elefus/events{/privacy}","received_events_url":"https://api.github.com/users/elefus/received_events","type":"User","site_admin":false},"repo":{"id":135138264,"node_id":"MDEwOlJlcG9zaXRvcnkxMzUxMzgyNjQ=","name":"epam-lab-java8-2018-06","full_name":"elefus/epam-lab-java8-2018-06","owner":{"login":"elefus","id":15202315,"node_id":"MDQ6VXNlcjE1MjAyMzE1","avatar_url":"https://avatars1.githubusercontent.com/u/15202315?v=4","gravatar_id":"","url":"https://api.github.com/users/elefus","html_url":"https://github.com/elefus","followers_url":"https://api.github.com/users/elefus/followers","following_url":"https://api.github.com/users/elefus/following{/other_user}","gists_url":"https://api.github.com/users/elefus/gists{/gist_id}","starred_url":"https://api.github.com/users/elefus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elefus/subscriptions","organizations_url":"https://api.github.com/users/elefus/orgs","repos_url":"https://api.github.com/users/elefus/repos","events_url":"https://api.github.com/users/elefus/events{/privacy}","received_events_url":"https://api.github.com/users/elefus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/elefus/epam-lab-java8-2018-06","description":null,"fork":false,"url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06","forks_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/forks","keys_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/teams","hooks_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/hooks","issue_events_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/issues/events{/number}","events_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/events","assignees_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/assignees{/user}","branches_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/branches{/branch}","tags_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/tags","blobs_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/git/refs{/sha}","trees_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/statuses/{sha}","languages_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/languages","stargazers_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/stargazers","contributors_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/contributors","subscribers_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/subscribers","subscription_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/subscription","commits_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/commits{/sha}","git_commits_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/git/commits{/sha}","comments_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/comments{/number}","issue_comment_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/issues/comments{/number}","contents_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/contents/{+path}","compare_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/merges","archive_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/downloads","issues_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/issues{/number}","pulls_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls{/number}","milestones_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/milestones{/number}","notifications_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/labels{/name}","releases_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/releases{/id}","deployments_url":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/deployments","created_at":"2018-05-28T09:17:30Z","updated_at":"2018-06-01T11:23:22Z","pushed_at":"2018-06-19T19:20:17Z","git_url":"git://github.com/elefus/epam-lab-java8-2018-06.git","ssh_url":"git@github.com:elefus/epam-lab-java8-2018-06.git","clone_url":"https://github.com/elefus/epam-lab-java8-2018-06.git","svn_url":"https://github.com/elefus/epam-lab-java8-2018-06","homepage":null,"size":194,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":163,"license":null,"forks":31,"open_issues":163,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/194"},"html":{"href":"https://github.com/elefus/epam-lab-java8-2018-06/pull/194"},"issue":{"href":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/issues/194"},"comments":{"href":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/issues/194/comments"},"review_comments":{"href":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/194/comments"},"review_comment":{"href":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/pulls/194/commits"},"statuses":{"href":"https://api.github.com/repos/elefus/epam-lab-java8-2018-06/statuses/0b46f3d423afa0922b3062ee4ecd53b76c126206"}},"author_association":"NONE"}}
{"actor":{"display_login":"shaart"}}