{"action":"created","comment":{"url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/comments/230116218","pull_request_review_id":170776416,"id":230116218,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDExNjIxOA==","diff_hunk":"@@ -1,34 +1,58 @@\n package com.codecool;\n \n-import java.util.HashSet;\n+import java.util.*;\n import java.util.LinkedList;\n-import java.util.Set;\n+\n+\n \n public class Trapper {\n-    private static final int MAX_PAGES_TO_SEARCH = 1000000000;\n+    private static final int MAX_PAGES_TO_SEARCH = 100000;\n     private Set<String> pagesVisited = new HashSet<String>();\n     private LinkedList<String> pagesToVisit = new LinkedList<>();\n     int visitedPages = 0;\n \n     private void addUrl(String url){\n-\n+        if(pagesVisited.add(url)){\n+            pagesToVisit.addLast(url);\n+        }\n     }\n \n     private String nextUrl(){\n-        return \"\";\n+        return pagesToVisit.removeFirst();\n+\n     }\n \n     public void search(String url, String searchedWord, String searchedTitle){\n         this.addUrl(url);\n         long start = System.currentTimeMillis();\n \n-        while(this.pagesVisited.size() < MAX_PAGES_TO_SEARCH)\n-        {\n+        while(this.pagesVisited.size() < MAX_PAGES_TO_SEARCH) {\n             String currentUrl;\n             HTTPHandler handler = new HTTPHandler();\n \n-            // TODO: use HTTP class to crawl over sites\n-\n+            if(this.pagesToVisit.isEmpty()){","path":"src/com/codecool/Trapper.java","position":42,"original_position":42,"commit_id":"97a5b9ba5bbee721e742b879ec85d0123a7b41d5","original_commit_id":"97a5b9ba5bbee721e742b879ec85d0123a7b41d5","user":{"login":"pwmarcz","id":468495,"node_id":"MDQ6VXNlcjQ2ODQ5NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/468495?v=4","gravatar_id":"","url":"https://api.github.com/users/pwmarcz","html_url":"https://github.com/pwmarcz","followers_url":"https://api.github.com/users/pwmarcz/followers","following_url":"https://api.github.com/users/pwmarcz/following{/other_user}","gists_url":"https://api.github.com/users/pwmarcz/gists{/gist_id}","starred_url":"https://api.github.com/users/pwmarcz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwmarcz/subscriptions","organizations_url":"https://api.github.com/users/pwmarcz/orgs","repos_url":"https://api.github.com/users/pwmarcz/repos","events_url":"https://api.github.com/users/pwmarcz/events{/privacy}","received_events_url":"https://api.github.com/users/pwmarcz/received_events","type":"User","site_admin":false},"body":"You're using `nextUrl` instead of accessing the set directly, so there should also be `hasNextUrl` method. This way your code operates on one level of abstraction (and you can, for instance, easily switch the set-based implementation to something else).\r\n\r\n```\r\nif (hasNextUrl()) {\r\n   currentUrl = nextUrl();\r\n   ...\r\n} else {\r\n   print \"Out of urls\";\r\n   ...\r\n}\r\n```","created_at":"2018-11-01T16:57:33Z","updated_at":"2018-11-01T16:58:09Z","html_url":"https://github.com/AJuszczakiewicz/TrapperBase/pull/2#discussion_r230116218","pull_request_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/2","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/comments/230116218"},"html":{"href":"https://github.com/AJuszczakiewicz/TrapperBase/pull/2#discussion_r230116218"},"pull_request":{"href":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/2","id":227675548,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3Njc1NTQ4","html_url":"https://github.com/AJuszczakiewicz/TrapperBase/pull/2","diff_url":"https://github.com/AJuszczakiewicz/TrapperBase/pull/2.diff","patch_url":"https://github.com/AJuszczakiewicz/TrapperBase/pull/2.patch","issue_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/issues/2","number":2,"state":"open","locked":false,"title":"My simple implementation","user":{"login":"AJuszczakiewicz","id":9095124,"node_id":"MDQ6VXNlcjkwOTUxMjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/9095124?v=4","gravatar_id":"","url":"https://api.github.com/users/AJuszczakiewicz","html_url":"https://github.com/AJuszczakiewicz","followers_url":"https://api.github.com/users/AJuszczakiewicz/followers","following_url":"https://api.github.com/users/AJuszczakiewicz/following{/other_user}","gists_url":"https://api.github.com/users/AJuszczakiewicz/gists{/gist_id}","starred_url":"https://api.github.com/users/AJuszczakiewicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AJuszczakiewicz/subscriptions","organizations_url":"https://api.github.com/users/AJuszczakiewicz/orgs","repos_url":"https://api.github.com/users/AJuszczakiewicz/repos","events_url":"https://api.github.com/users/AJuszczakiewicz/events{/privacy}","received_events_url":"https://api.github.com/users/AJuszczakiewicz/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-01T16:18:57Z","updated_at":"2018-11-01T16:58:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b142a54837140f90a9bbdb1f3fa7bb089abcee01","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/2/commits","review_comments_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/2/comments","review_comment_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/issues/2/comments","statuses_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/statuses/97a5b9ba5bbee721e742b879ec85d0123a7b41d5","head":{"label":"AJuszczakiewicz:my_simple_implementation","ref":"my_simple_implementation","sha":"97a5b9ba5bbee721e742b879ec85d0123a7b41d5","user":{"login":"AJuszczakiewicz","id":9095124,"node_id":"MDQ6VXNlcjkwOTUxMjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/9095124?v=4","gravatar_id":"","url":"https://api.github.com/users/AJuszczakiewicz","html_url":"https://github.com/AJuszczakiewicz","followers_url":"https://api.github.com/users/AJuszczakiewicz/followers","following_url":"https://api.github.com/users/AJuszczakiewicz/following{/other_user}","gists_url":"https://api.github.com/users/AJuszczakiewicz/gists{/gist_id}","starred_url":"https://api.github.com/users/AJuszczakiewicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AJuszczakiewicz/subscriptions","organizations_url":"https://api.github.com/users/AJuszczakiewicz/orgs","repos_url":"https://api.github.com/users/AJuszczakiewicz/repos","events_url":"https://api.github.com/users/AJuszczakiewicz/events{/privacy}","received_events_url":"https://api.github.com/users/AJuszczakiewicz/received_events","type":"User","site_admin":false},"repo":{"id":155740112,"node_id":"MDEwOlJlcG9zaXRvcnkxNTU3NDAxMTI=","name":"TrapperBase","full_name":"AJuszczakiewicz/TrapperBase","private":false,"owner":{"login":"AJuszczakiewicz","id":9095124,"node_id":"MDQ6VXNlcjkwOTUxMjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/9095124?v=4","gravatar_id":"","url":"https://api.github.com/users/AJuszczakiewicz","html_url":"https://github.com/AJuszczakiewicz","followers_url":"https://api.github.com/users/AJuszczakiewicz/followers","following_url":"https://api.github.com/users/AJuszczakiewicz/following{/other_user}","gists_url":"https://api.github.com/users/AJuszczakiewicz/gists{/gist_id}","starred_url":"https://api.github.com/users/AJuszczakiewicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AJuszczakiewicz/subscriptions","organizations_url":"https://api.github.com/users/AJuszczakiewicz/orgs","repos_url":"https://api.github.com/users/AJuszczakiewicz/repos","events_url":"https://api.github.com/users/AJuszczakiewicz/events{/privacy}","received_events_url":"https://api.github.com/users/AJuszczakiewicz/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AJuszczakiewicz/TrapperBase","description":"Skeleton for trapper app","fork":false,"url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase","forks_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/forks","keys_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/teams","hooks_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/hooks","issue_events_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/issues/events{/number}","events_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/events","assignees_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/assignees{/user}","branches_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/branches{/branch}","tags_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/tags","blobs_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/git/refs{/sha}","trees_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/statuses/{sha}","languages_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/languages","stargazers_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/stargazers","contributors_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/contributors","subscribers_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/subscribers","subscription_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/subscription","commits_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/commits{/sha}","git_commits_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/git/commits{/sha}","comments_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/comments{/number}","issue_comment_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/issues/comments{/number}","contents_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/contents/{+path}","compare_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/merges","archive_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/downloads","issues_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/issues{/number}","pulls_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls{/number}","milestones_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/milestones{/number}","notifications_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/labels{/name}","releases_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/releases{/id}","deployments_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/deployments","created_at":"2018-11-01T15:59:02Z","updated_at":"2018-11-01T16:02:28Z","pushed_at":"2018-11-01T16:18:57Z","git_url":"git://github.com/AJuszczakiewicz/TrapperBase.git","ssh_url":"git@github.com:AJuszczakiewicz/TrapperBase.git","clone_url":"https://github.com/AJuszczakiewicz/TrapperBase.git","svn_url":"https://github.com/AJuszczakiewicz/TrapperBase","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"AJuszczakiewicz:homework","ref":"homework","sha":"92befec83be9ed398e44d156de907d33fba70678","user":{"login":"AJuszczakiewicz","id":9095124,"node_id":"MDQ6VXNlcjkwOTUxMjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/9095124?v=4","gravatar_id":"","url":"https://api.github.com/users/AJuszczakiewicz","html_url":"https://github.com/AJuszczakiewicz","followers_url":"https://api.github.com/users/AJuszczakiewicz/followers","following_url":"https://api.github.com/users/AJuszczakiewicz/following{/other_user}","gists_url":"https://api.github.com/users/AJuszczakiewicz/gists{/gist_id}","starred_url":"https://api.github.com/users/AJuszczakiewicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AJuszczakiewicz/subscriptions","organizations_url":"https://api.github.com/users/AJuszczakiewicz/orgs","repos_url":"https://api.github.com/users/AJuszczakiewicz/repos","events_url":"https://api.github.com/users/AJuszczakiewicz/events{/privacy}","received_events_url":"https://api.github.com/users/AJuszczakiewicz/received_events","type":"User","site_admin":false},"repo":{"id":155740112,"node_id":"MDEwOlJlcG9zaXRvcnkxNTU3NDAxMTI=","name":"TrapperBase","full_name":"AJuszczakiewicz/TrapperBase","private":false,"owner":{"login":"AJuszczakiewicz","id":9095124,"node_id":"MDQ6VXNlcjkwOTUxMjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/9095124?v=4","gravatar_id":"","url":"https://api.github.com/users/AJuszczakiewicz","html_url":"https://github.com/AJuszczakiewicz","followers_url":"https://api.github.com/users/AJuszczakiewicz/followers","following_url":"https://api.github.com/users/AJuszczakiewicz/following{/other_user}","gists_url":"https://api.github.com/users/AJuszczakiewicz/gists{/gist_id}","starred_url":"https://api.github.com/users/AJuszczakiewicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AJuszczakiewicz/subscriptions","organizations_url":"https://api.github.com/users/AJuszczakiewicz/orgs","repos_url":"https://api.github.com/users/AJuszczakiewicz/repos","events_url":"https://api.github.com/users/AJuszczakiewicz/events{/privacy}","received_events_url":"https://api.github.com/users/AJuszczakiewicz/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AJuszczakiewicz/TrapperBase","description":"Skeleton for trapper app","fork":false,"url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase","forks_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/forks","keys_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/teams","hooks_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/hooks","issue_events_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/issues/events{/number}","events_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/events","assignees_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/assignees{/user}","branches_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/branches{/branch}","tags_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/tags","blobs_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/git/refs{/sha}","trees_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/statuses/{sha}","languages_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/languages","stargazers_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/stargazers","contributors_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/contributors","subscribers_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/subscribers","subscription_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/subscription","commits_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/commits{/sha}","git_commits_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/git/commits{/sha}","comments_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/comments{/number}","issue_comment_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/issues/comments{/number}","contents_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/contents/{+path}","compare_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/merges","archive_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/downloads","issues_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/issues{/number}","pulls_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls{/number}","milestones_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/milestones{/number}","notifications_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/labels{/name}","releases_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/releases{/id}","deployments_url":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/deployments","created_at":"2018-11-01T15:59:02Z","updated_at":"2018-11-01T16:02:28Z","pushed_at":"2018-11-01T16:18:57Z","git_url":"git://github.com/AJuszczakiewicz/TrapperBase.git","ssh_url":"git@github.com:AJuszczakiewicz/TrapperBase.git","clone_url":"https://github.com/AJuszczakiewicz/TrapperBase.git","svn_url":"https://github.com/AJuszczakiewicz/TrapperBase","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/2"},"html":{"href":"https://github.com/AJuszczakiewicz/TrapperBase/pull/2"},"issue":{"href":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/issues/2"},"comments":{"href":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/AJuszczakiewicz/TrapperBase/statuses/97a5b9ba5bbee721e742b879ec85d0123a7b41d5"}},"author_association":"OWNER"}}
{"actor":{"display_login":"pwmarcz"}}