{"action":"created","comment":{"url":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/comments/282421876","pull_request_review_id":235505117,"id":282421876,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI4MjQyMTg3Ng==","diff_hunk":"@@ -0,0 +1,177 @@\n+package group144.afrikanov;\n+\n+import java.io.IOException;\n+\n+/** Class implements methods of a list. */\n+public class LinkedList<T> {\n+\n+    private Node<T> head = null, tail = null;\n+    private int size = 0;\n+\n+    public int getSize() {\n+        return size;\n+    }\n+\n+    /**\n+     * Method adds a new node after certain.\n+     * @param item - node after which new item should be\n+     * @param value - value which is need to add\n+     * @throws InvalidInputNode when the node after which you want to insert is equal to null\n+     */\n+    public void insertAfter(Node<T> item, T value) throws InvalidInputNode {\n+        if (item == null) {\n+            throw new InvalidInputNode();\n+        }\n+        Node<T> newItem = new Node<>(value, item.next, item);\n+        item.next = newItem;\n+        if (newItem.next != null) {\n+            newItem.next.previous = newItem;\n+        }\n+        size++;\n+    }\n+\n+    /**\n+     * Method inserts an element after all other\n+     * @param value - value which is need to add\n+     */\n+    public void insertBack(T value) {\n+        tail = new Node<T>(value, null, tail);\n+        if (head == null) {\n+            head = tail;\n+        } else {\n+            tail.previous.next = tail;\n+        }\n+        size++;\n+    }\n+\n+    /**\n+     * Method inserts an element before all other\n+     * @param value - value which is need to add\n+     */\n+    public void insertFront(T value) {\n+        head = new Node<>(value, head, null);\n+        if (tail == null) {\n+            tail = head;\n+        } else {\n+            head.next.previous = head;\n+        }\n+        size++;\n+    }\n+\n+    /**\n+     * Method removes a node after certain.\n+     * @param item - node which should be removed\n+     */\n+    public void removeNode(Node<T> item) {\n+        item.previous.next = item.next;\n+        item.next.previous = item.previous;\n+        size--;\n+    }\n+\n+    /**\n+     * Method removes the first node with certain value.\n+     * @param value - value which is need to add\n+     * @throws ValueNotFoundException when the value is not found\n+     */\n+    public void removeByValue(T value) throws ValueNotFoundException {\n+        Node<T> certainNode = search(value);\n+        if (certainNode != null) {\n+            removeNode(certainNode);\n+        } else {\n+            throw new ValueNotFoundException();\n+        }\n+    }\n+\n+    /**\n+     * Method removes a head of a list.\n+     * @throws ValueNotFoundException when the value is not found\n+     */\n+    public void removeHead() throws ValueNotFoundException {\n+        if (head != null) {\n+            head = head.next;\n+            if (head != null) {\n+                head.previous = null;\n+            }\n+            size--;\n+        } else {\n+            throw new ValueNotFoundException();\n+        }\n+    }\n+\n+    /**\n+     * Method removes a tail of a list.\n+     * @throws ValueNotFoundException when the value is not found\n+     */\n+    public void removeTail() throws ValueNotFoundException {\n+        if (tail != null) {\n+            tail = tail.previous;\n+            if (tail != null) {\n+                tail.next = null;\n+            }\n+            size--;\n+        } else {\n+            throw new ValueNotFoundException();\n+        }\n+    }\n+\n+    public boolean isEmpty() {\n+        return size == 0;\n+    }\n+\n+    /**\n+     * @param index of the element we want to get\n+     * @return current value\n+     * @throws IndexOutOfBoundsException when index is out of bounds\n+     */\n+    public T getValueByIndex(int index) throws IndexOutOfBoundsException {\n+        if ((index >= size) || (index < 0)) {\n+            throw new IndexOutOfBoundsException();\n+        } else {\n+            return getNodeByIndex(index).value;\n+        }\n+    }\n+\n+    /**\n+     * @param index of the element we want to get\n+     * @return current Node\n+     * @throws IndexOutOfBoundsException when index is out of bounds\n+     */\n+    public Node<T> getNodeByIndex(int index) throws IndexOutOfBoundsException {\n+        if ((index >= size) || (index < 0)) {\n+            throw new IndexOutOfBoundsException();\n+        } else {\n+            Node<T> result = head;\n+            for (int i = 0; i < index; i++) {\n+                result = result.next;\n+            }\n+            return result;\n+        }\n+    }\n+\n+    /**\n+     * Method searches a node with certain value.\n+     * @param value we want to find\n+     * @return Found node or null if it doesn't exist.\n+     */\n+    public Node<T> search(T value) {\n+        Node<T> item = head;\n+        while (item != null && value != item.value) {\n+            item = item.next;\n+        }\n+        return item;\n+    }\n+\n+    /** Class implements structure with 2 fields : value and link on the next element. */\n+    public class Node<T> {\n+\n+        public T value;","path":"hw04/task1/src/main/java/group144/afrikanov/LinkedList.java","position":null,"original_position":167,"commit_id":"dd0ae3fd91ef0f51f12da4c352386b321ef695f9","original_commit_id":"2716d6cbaf3595783fe4f7895e5e72b0750db95f","user":{"login":"jzuken","id":705678,"node_id":"MDQ6VXNlcjcwNTY3OA==","avatar_url":"https://avatars1.githubusercontent.com/u/705678?v=4","gravatar_id":"","url":"https://api.github.com/users/jzuken","html_url":"https://github.com/jzuken","followers_url":"https://api.github.com/users/jzuken/followers","following_url":"https://api.github.com/users/jzuken/following{/other_user}","gists_url":"https://api.github.com/users/jzuken/gists{/gist_id}","starred_url":"https://api.github.com/users/jzuken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzuken/subscriptions","organizations_url":"https://api.github.com/users/jzuken/orgs","repos_url":"https://api.github.com/users/jzuken/repos","events_url":"https://api.github.com/users/jzuken/events{/privacy}","received_events_url":"https://api.github.com/users/jzuken/received_events","type":"User","site_admin":false},"body":"значит это тоже надо поправить, не хочет никто снаружи знать ни про какие ноды, они хотят класть значения в список и получать обратно именно их","created_at":"2019-05-09T10:06:40Z","updated_at":"2019-05-09T10:06:40Z","html_url":"https://github.com/afrikanov/Spbu-sem2/pull/10#discussion_r282421876","pull_request_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/10","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/comments/282421876"},"html":{"href":"https://github.com/afrikanov/Spbu-sem2/pull/10#discussion_r282421876"},"pull_request":{"href":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/10"}},"in_reply_to_id":281019748},"pull_request":{"url":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/10","id":269364755,"node_id":"MDExOlB1bGxSZXF1ZXN0MjY5MzY0NzU1","html_url":"https://github.com/afrikanov/Spbu-sem2/pull/10","diff_url":"https://github.com/afrikanov/Spbu-sem2/pull/10.diff","patch_url":"https://github.com/afrikanov/Spbu-sem2/pull/10.patch","issue_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/issues/10","number":10,"state":"open","locked":false,"title":"added task 4.1","user":{"login":"afrikanov","id":43299725,"node_id":"MDQ6VXNlcjQzMjk5NzI1","avatar_url":"https://avatars2.githubusercontent.com/u/43299725?v=4","gravatar_id":"","url":"https://api.github.com/users/afrikanov","html_url":"https://github.com/afrikanov","followers_url":"https://api.github.com/users/afrikanov/followers","following_url":"https://api.github.com/users/afrikanov/following{/other_user}","gists_url":"https://api.github.com/users/afrikanov/gists{/gist_id}","starred_url":"https://api.github.com/users/afrikanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afrikanov/subscriptions","organizations_url":"https://api.github.com/users/afrikanov/orgs","repos_url":"https://api.github.com/users/afrikanov/repos","events_url":"https://api.github.com/users/afrikanov/events{/privacy}","received_events_url":"https://api.github.com/users/afrikanov/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-04-10T23:02:15Z","updated_at":"2019-05-09T10:06:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2a6a17498a756d7c59473535c154f4842c953bb4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/10/commits","review_comments_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/10/comments","review_comment_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/issues/10/comments","statuses_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/statuses/dd0ae3fd91ef0f51f12da4c352386b321ef695f9","head":{"label":"afrikanov:hw04.1","ref":"hw04.1","sha":"dd0ae3fd91ef0f51f12da4c352386b321ef695f9","user":{"login":"afrikanov","id":43299725,"node_id":"MDQ6VXNlcjQzMjk5NzI1","avatar_url":"https://avatars2.githubusercontent.com/u/43299725?v=4","gravatar_id":"","url":"https://api.github.com/users/afrikanov","html_url":"https://github.com/afrikanov","followers_url":"https://api.github.com/users/afrikanov/followers","following_url":"https://api.github.com/users/afrikanov/following{/other_user}","gists_url":"https://api.github.com/users/afrikanov/gists{/gist_id}","starred_url":"https://api.github.com/users/afrikanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afrikanov/subscriptions","organizations_url":"https://api.github.com/users/afrikanov/orgs","repos_url":"https://api.github.com/users/afrikanov/repos","events_url":"https://api.github.com/users/afrikanov/events{/privacy}","received_events_url":"https://api.github.com/users/afrikanov/received_events","type":"User","site_admin":false},"repo":{"id":172043364,"node_id":"MDEwOlJlcG9zaXRvcnkxNzIwNDMzNjQ=","name":"Spbu-sem2","full_name":"afrikanov/Spbu-sem2","private":false,"owner":{"login":"afrikanov","id":43299725,"node_id":"MDQ6VXNlcjQzMjk5NzI1","avatar_url":"https://avatars2.githubusercontent.com/u/43299725?v=4","gravatar_id":"","url":"https://api.github.com/users/afrikanov","html_url":"https://github.com/afrikanov","followers_url":"https://api.github.com/users/afrikanov/followers","following_url":"https://api.github.com/users/afrikanov/following{/other_user}","gists_url":"https://api.github.com/users/afrikanov/gists{/gist_id}","starred_url":"https://api.github.com/users/afrikanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afrikanov/subscriptions","organizations_url":"https://api.github.com/users/afrikanov/orgs","repos_url":"https://api.github.com/users/afrikanov/repos","events_url":"https://api.github.com/users/afrikanov/events{/privacy}","received_events_url":"https://api.github.com/users/afrikanov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/afrikanov/Spbu-sem2","description":"My SPBU homeworks","fork":false,"url":"https://api.github.com/repos/afrikanov/Spbu-sem2","forks_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/forks","keys_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/teams","hooks_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/hooks","issue_events_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/issues/events{/number}","events_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/events","assignees_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/assignees{/user}","branches_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/branches{/branch}","tags_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/tags","blobs_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/git/refs{/sha}","trees_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/statuses/{sha}","languages_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/languages","stargazers_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/stargazers","contributors_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/contributors","subscribers_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/subscribers","subscription_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/subscription","commits_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/commits{/sha}","git_commits_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/git/commits{/sha}","comments_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/comments{/number}","issue_comment_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/issues/comments{/number}","contents_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/contents/{+path}","compare_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/merges","archive_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/downloads","issues_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/issues{/number}","pulls_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls{/number}","milestones_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/milestones{/number}","notifications_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/labels{/name}","releases_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/releases{/id}","deployments_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/deployments","created_at":"2019-02-22T10:09:27Z","updated_at":"2019-02-22T10:09:30Z","pushed_at":"2019-05-08T16:32:32Z","git_url":"git://github.com/afrikanov/Spbu-sem2.git","ssh_url":"git@github.com:afrikanov/Spbu-sem2.git","clone_url":"https://github.com/afrikanov/Spbu-sem2.git","svn_url":"https://github.com/afrikanov/Spbu-sem2","homepage":null,"size":124,"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,"disabled":false,"open_issues_count":17,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":17,"watchers":0,"default_branch":"master"}},"base":{"label":"afrikanov:master","ref":"master","sha":"925beef109380fd920a771703d739b845d1227b0","user":{"login":"afrikanov","id":43299725,"node_id":"MDQ6VXNlcjQzMjk5NzI1","avatar_url":"https://avatars2.githubusercontent.com/u/43299725?v=4","gravatar_id":"","url":"https://api.github.com/users/afrikanov","html_url":"https://github.com/afrikanov","followers_url":"https://api.github.com/users/afrikanov/followers","following_url":"https://api.github.com/users/afrikanov/following{/other_user}","gists_url":"https://api.github.com/users/afrikanov/gists{/gist_id}","starred_url":"https://api.github.com/users/afrikanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afrikanov/subscriptions","organizations_url":"https://api.github.com/users/afrikanov/orgs","repos_url":"https://api.github.com/users/afrikanov/repos","events_url":"https://api.github.com/users/afrikanov/events{/privacy}","received_events_url":"https://api.github.com/users/afrikanov/received_events","type":"User","site_admin":false},"repo":{"id":172043364,"node_id":"MDEwOlJlcG9zaXRvcnkxNzIwNDMzNjQ=","name":"Spbu-sem2","full_name":"afrikanov/Spbu-sem2","private":false,"owner":{"login":"afrikanov","id":43299725,"node_id":"MDQ6VXNlcjQzMjk5NzI1","avatar_url":"https://avatars2.githubusercontent.com/u/43299725?v=4","gravatar_id":"","url":"https://api.github.com/users/afrikanov","html_url":"https://github.com/afrikanov","followers_url":"https://api.github.com/users/afrikanov/followers","following_url":"https://api.github.com/users/afrikanov/following{/other_user}","gists_url":"https://api.github.com/users/afrikanov/gists{/gist_id}","starred_url":"https://api.github.com/users/afrikanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afrikanov/subscriptions","organizations_url":"https://api.github.com/users/afrikanov/orgs","repos_url":"https://api.github.com/users/afrikanov/repos","events_url":"https://api.github.com/users/afrikanov/events{/privacy}","received_events_url":"https://api.github.com/users/afrikanov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/afrikanov/Spbu-sem2","description":"My SPBU homeworks","fork":false,"url":"https://api.github.com/repos/afrikanov/Spbu-sem2","forks_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/forks","keys_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/teams","hooks_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/hooks","issue_events_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/issues/events{/number}","events_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/events","assignees_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/assignees{/user}","branches_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/branches{/branch}","tags_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/tags","blobs_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/git/refs{/sha}","trees_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/statuses/{sha}","languages_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/languages","stargazers_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/stargazers","contributors_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/contributors","subscribers_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/subscribers","subscription_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/subscription","commits_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/commits{/sha}","git_commits_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/git/commits{/sha}","comments_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/comments{/number}","issue_comment_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/issues/comments{/number}","contents_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/contents/{+path}","compare_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/merges","archive_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/downloads","issues_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/issues{/number}","pulls_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls{/number}","milestones_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/milestones{/number}","notifications_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/labels{/name}","releases_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/releases{/id}","deployments_url":"https://api.github.com/repos/afrikanov/Spbu-sem2/deployments","created_at":"2019-02-22T10:09:27Z","updated_at":"2019-02-22T10:09:30Z","pushed_at":"2019-05-08T16:32:32Z","git_url":"git://github.com/afrikanov/Spbu-sem2.git","ssh_url":"git@github.com:afrikanov/Spbu-sem2.git","clone_url":"https://github.com/afrikanov/Spbu-sem2.git","svn_url":"https://github.com/afrikanov/Spbu-sem2","homepage":null,"size":124,"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,"disabled":false,"open_issues_count":17,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":17,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/10"},"html":{"href":"https://github.com/afrikanov/Spbu-sem2/pull/10"},"issue":{"href":"https://api.github.com/repos/afrikanov/Spbu-sem2/issues/10"},"comments":{"href":"https://api.github.com/repos/afrikanov/Spbu-sem2/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/afrikanov/Spbu-sem2/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/afrikanov/Spbu-sem2/statuses/dd0ae3fd91ef0f51f12da4c352386b321ef695f9"}},"author_association":"OWNER"}}
{"actor":{"display_login":"jzuken"}}