{"action":"created","comment":{"url":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/comments/106785494","pull_request_review_id":27728567,"id":106785494,"diff_hunk":"@@ -10,32 +10,65 @@\n  * - с аргументом - начальный размер массива\n  */\n public class MyArrayList extends List {\n+    private int[] array;\n+    public static final int startLen = 100;\n+    private int tail; // Индекс хвоста: указывает на следующую после последней заполненной ячейки\n+                    // и задает фактическую длину массива\n+    private int len; // Длина, доступная для зополнения без расширения массива\n \n     public MyArrayList() {\n-\n+        array = new int[startLen];\n+        len = startLen;\n+        tail = 0;\n     }\n \n     public MyArrayList(int capacity) {\n-\n+        if (capacity < 1) {\n+            capacity = 1;\n+            System.out.println(\"Размер не может быть меньше 1. Создан массив размером 1.\");\n+        }\n+        array = new int[capacity];\n+        len = capacity;\n+        tail = 0;\n     }\n \n     @Override\n     void add(int item) {\n-\n+        if (tail == len) {\n+            int[] arrayTemp = new int[len + startLen];\n+            System.arraycopy(array, 0, arrayTemp,0 , len);\n+            array = arrayTemp;\n+            len += startLen;\n+        }\n+        array[tail++] = item;\n     }\n \n     @Override\n     int remove(int idx) throws NoSuchElementException {\n-        return 0;\n+        if (idx >= tail || idx < 0) {\n+            throw new NoSuchElementException();\n+        } else {\n+            int item = array[idx];\n+            int[] arrayTemp = new int[len];\n+            System.arraycopy(array, 0, arrayTemp,0 , idx);","path":"src/main/java/track/lessons/lesson3/MyArrayList.java","position":48,"original_position":48,"commit_id":"41a4bcdbd7dfa293409cab664de09ba63d31814c","original_commit_id":"41a4bcdbd7dfa293409cab664de09ba63d31814c","user":{"login":"tehnotrack","id":22426428,"avatar_url":"https://avatars3.githubusercontent.com/u/22426428?v=3","gravatar_id":"","url":"https://api.github.com/users/tehnotrack","html_url":"https://github.com/tehnotrack","followers_url":"https://api.github.com/users/tehnotrack/followers","following_url":"https://api.github.com/users/tehnotrack/following{/other_user}","gists_url":"https://api.github.com/users/tehnotrack/gists{/gist_id}","starred_url":"https://api.github.com/users/tehnotrack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tehnotrack/subscriptions","organizations_url":"https://api.github.com/users/tehnotrack/orgs","repos_url":"https://api.github.com/users/tehnotrack/repos","events_url":"https://api.github.com/users/tehnotrack/events{/privacy}","received_events_url":"https://api.github.com/users/tehnotrack/received_events","type":"User","site_admin":false},"body":"при remove можно обойтись одним вызовом arraycopy. Подумайте как","created_at":"2017-03-18T16:50:43Z","updated_at":"2017-03-18T16:51:03Z","html_url":"https://github.com/tehnotrack/track17-spring/pull/68#discussion_r106785494","pull_request_url":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/68","_links":{"self":{"href":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/comments/106785494"},"html":{"href":"https://github.com/tehnotrack/track17-spring/pull/68#discussion_r106785494"},"pull_request":{"href":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/68"}}},"pull_request":{"url":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/68","id":111066336,"html_url":"https://github.com/tehnotrack/track17-spring/pull/68","diff_url":"https://github.com/tehnotrack/track17-spring/pull/68.diff","patch_url":"https://github.com/tehnotrack/track17-spring/pull/68.patch","issue_url":"https://api.github.com/repos/tehnotrack/track17-spring/issues/68","number":68,"state":"open","locked":false,"title":"Macket-list","user":{"login":"Macket","id":26141527,"avatar_url":"https://avatars3.githubusercontent.com/u/26141527?v=3","gravatar_id":"","url":"https://api.github.com/users/Macket","html_url":"https://github.com/Macket","followers_url":"https://api.github.com/users/Macket/followers","following_url":"https://api.github.com/users/Macket/following{/other_user}","gists_url":"https://api.github.com/users/Macket/gists{/gist_id}","starred_url":"https://api.github.com/users/Macket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Macket/subscriptions","organizations_url":"https://api.github.com/users/Macket/orgs","repos_url":"https://api.github.com/users/Macket/repos","events_url":"https://api.github.com/users/Macket/events{/privacy}","received_events_url":"https://api.github.com/users/Macket/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-03-16T13:23:14Z","updated_at":"2017-03-18T16:51:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8491a7f52506933b26e473797cfd5888ff8b4ced","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/68/commits","review_comments_url":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/68/comments","review_comment_url":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tehnotrack/track17-spring/issues/68/comments","statuses_url":"https://api.github.com/repos/tehnotrack/track17-spring/statuses/41a4bcdbd7dfa293409cab664de09ba63d31814c","head":{"label":"Macket:Macket-list","ref":"Macket-list","sha":"41a4bcdbd7dfa293409cab664de09ba63d31814c","user":{"login":"Macket","id":26141527,"avatar_url":"https://avatars3.githubusercontent.com/u/26141527?v=3","gravatar_id":"","url":"https://api.github.com/users/Macket","html_url":"https://github.com/Macket","followers_url":"https://api.github.com/users/Macket/followers","following_url":"https://api.github.com/users/Macket/following{/other_user}","gists_url":"https://api.github.com/users/Macket/gists{/gist_id}","starred_url":"https://api.github.com/users/Macket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Macket/subscriptions","organizations_url":"https://api.github.com/users/Macket/orgs","repos_url":"https://api.github.com/users/Macket/repos","events_url":"https://api.github.com/users/Macket/events{/privacy}","received_events_url":"https://api.github.com/users/Macket/received_events","type":"User","site_admin":false},"repo":{"id":84186354,"name":"track17-spring","full_name":"Macket/track17-spring","owner":{"login":"Macket","id":26141527,"avatar_url":"https://avatars3.githubusercontent.com/u/26141527?v=3","gravatar_id":"","url":"https://api.github.com/users/Macket","html_url":"https://github.com/Macket","followers_url":"https://api.github.com/users/Macket/followers","following_url":"https://api.github.com/users/Macket/following{/other_user}","gists_url":"https://api.github.com/users/Macket/gists{/gist_id}","starred_url":"https://api.github.com/users/Macket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Macket/subscriptions","organizations_url":"https://api.github.com/users/Macket/orgs","repos_url":"https://api.github.com/users/Macket/repos","events_url":"https://api.github.com/users/Macket/events{/privacy}","received_events_url":"https://api.github.com/users/Macket/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Macket/track17-spring","description":"Курс Java Технотрек@mail.ru Весна 2017","fork":true,"url":"https://api.github.com/repos/Macket/track17-spring","forks_url":"https://api.github.com/repos/Macket/track17-spring/forks","keys_url":"https://api.github.com/repos/Macket/track17-spring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Macket/track17-spring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Macket/track17-spring/teams","hooks_url":"https://api.github.com/repos/Macket/track17-spring/hooks","issue_events_url":"https://api.github.com/repos/Macket/track17-spring/issues/events{/number}","events_url":"https://api.github.com/repos/Macket/track17-spring/events","assignees_url":"https://api.github.com/repos/Macket/track17-spring/assignees{/user}","branches_url":"https://api.github.com/repos/Macket/track17-spring/branches{/branch}","tags_url":"https://api.github.com/repos/Macket/track17-spring/tags","blobs_url":"https://api.github.com/repos/Macket/track17-spring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Macket/track17-spring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Macket/track17-spring/git/refs{/sha}","trees_url":"https://api.github.com/repos/Macket/track17-spring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Macket/track17-spring/statuses/{sha}","languages_url":"https://api.github.com/repos/Macket/track17-spring/languages","stargazers_url":"https://api.github.com/repos/Macket/track17-spring/stargazers","contributors_url":"https://api.github.com/repos/Macket/track17-spring/contributors","subscribers_url":"https://api.github.com/repos/Macket/track17-spring/subscribers","subscription_url":"https://api.github.com/repos/Macket/track17-spring/subscription","commits_url":"https://api.github.com/repos/Macket/track17-spring/commits{/sha}","git_commits_url":"https://api.github.com/repos/Macket/track17-spring/git/commits{/sha}","comments_url":"https://api.github.com/repos/Macket/track17-spring/comments{/number}","issue_comment_url":"https://api.github.com/repos/Macket/track17-spring/issues/comments{/number}","contents_url":"https://api.github.com/repos/Macket/track17-spring/contents/{+path}","compare_url":"https://api.github.com/repos/Macket/track17-spring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Macket/track17-spring/merges","archive_url":"https://api.github.com/repos/Macket/track17-spring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Macket/track17-spring/downloads","issues_url":"https://api.github.com/repos/Macket/track17-spring/issues{/number}","pulls_url":"https://api.github.com/repos/Macket/track17-spring/pulls{/number}","milestones_url":"https://api.github.com/repos/Macket/track17-spring/milestones{/number}","notifications_url":"https://api.github.com/repos/Macket/track17-spring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Macket/track17-spring/labels{/name}","releases_url":"https://api.github.com/repos/Macket/track17-spring/releases{/id}","deployments_url":"https://api.github.com/repos/Macket/track17-spring/deployments","created_at":"2017-03-07T10:28:42Z","updated_at":"2017-03-07T10:28:44Z","pushed_at":"2017-03-16T13:21:33Z","git_url":"git://github.com/Macket/track17-spring.git","ssh_url":"git@github.com:Macket/track17-spring.git","clone_url":"https://github.com/Macket/track17-spring.git","svn_url":"https://github.com/Macket/track17-spring","homepage":null,"size":38,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"tehnotrack:master","ref":"master","sha":"d088a39211ec018962f72c9baefdccc74720b31e","user":{"login":"tehnotrack","id":22426428,"avatar_url":"https://avatars3.githubusercontent.com/u/22426428?v=3","gravatar_id":"","url":"https://api.github.com/users/tehnotrack","html_url":"https://github.com/tehnotrack","followers_url":"https://api.github.com/users/tehnotrack/followers","following_url":"https://api.github.com/users/tehnotrack/following{/other_user}","gists_url":"https://api.github.com/users/tehnotrack/gists{/gist_id}","starred_url":"https://api.github.com/users/tehnotrack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tehnotrack/subscriptions","organizations_url":"https://api.github.com/users/tehnotrack/orgs","repos_url":"https://api.github.com/users/tehnotrack/repos","events_url":"https://api.github.com/users/tehnotrack/events{/privacy}","received_events_url":"https://api.github.com/users/tehnotrack/received_events","type":"User","site_admin":false},"repo":{"id":82676530,"name":"track17-spring","full_name":"tehnotrack/track17-spring","owner":{"login":"tehnotrack","id":22426428,"avatar_url":"https://avatars3.githubusercontent.com/u/22426428?v=3","gravatar_id":"","url":"https://api.github.com/users/tehnotrack","html_url":"https://github.com/tehnotrack","followers_url":"https://api.github.com/users/tehnotrack/followers","following_url":"https://api.github.com/users/tehnotrack/following{/other_user}","gists_url":"https://api.github.com/users/tehnotrack/gists{/gist_id}","starred_url":"https://api.github.com/users/tehnotrack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tehnotrack/subscriptions","organizations_url":"https://api.github.com/users/tehnotrack/orgs","repos_url":"https://api.github.com/users/tehnotrack/repos","events_url":"https://api.github.com/users/tehnotrack/events{/privacy}","received_events_url":"https://api.github.com/users/tehnotrack/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tehnotrack/track17-spring","description":"Курс Java Технотрек@mail.ru Весна 2017","fork":false,"url":"https://api.github.com/repos/tehnotrack/track17-spring","forks_url":"https://api.github.com/repos/tehnotrack/track17-spring/forks","keys_url":"https://api.github.com/repos/tehnotrack/track17-spring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tehnotrack/track17-spring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tehnotrack/track17-spring/teams","hooks_url":"https://api.github.com/repos/tehnotrack/track17-spring/hooks","issue_events_url":"https://api.github.com/repos/tehnotrack/track17-spring/issues/events{/number}","events_url":"https://api.github.com/repos/tehnotrack/track17-spring/events","assignees_url":"https://api.github.com/repos/tehnotrack/track17-spring/assignees{/user}","branches_url":"https://api.github.com/repos/tehnotrack/track17-spring/branches{/branch}","tags_url":"https://api.github.com/repos/tehnotrack/track17-spring/tags","blobs_url":"https://api.github.com/repos/tehnotrack/track17-spring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tehnotrack/track17-spring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tehnotrack/track17-spring/git/refs{/sha}","trees_url":"https://api.github.com/repos/tehnotrack/track17-spring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tehnotrack/track17-spring/statuses/{sha}","languages_url":"https://api.github.com/repos/tehnotrack/track17-spring/languages","stargazers_url":"https://api.github.com/repos/tehnotrack/track17-spring/stargazers","contributors_url":"https://api.github.com/repos/tehnotrack/track17-spring/contributors","subscribers_url":"https://api.github.com/repos/tehnotrack/track17-spring/subscribers","subscription_url":"https://api.github.com/repos/tehnotrack/track17-spring/subscription","commits_url":"https://api.github.com/repos/tehnotrack/track17-spring/commits{/sha}","git_commits_url":"https://api.github.com/repos/tehnotrack/track17-spring/git/commits{/sha}","comments_url":"https://api.github.com/repos/tehnotrack/track17-spring/comments{/number}","issue_comment_url":"https://api.github.com/repos/tehnotrack/track17-spring/issues/comments{/number}","contents_url":"https://api.github.com/repos/tehnotrack/track17-spring/contents/{+path}","compare_url":"https://api.github.com/repos/tehnotrack/track17-spring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tehnotrack/track17-spring/merges","archive_url":"https://api.github.com/repos/tehnotrack/track17-spring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tehnotrack/track17-spring/downloads","issues_url":"https://api.github.com/repos/tehnotrack/track17-spring/issues{/number}","pulls_url":"https://api.github.com/repos/tehnotrack/track17-spring/pulls{/number}","milestones_url":"https://api.github.com/repos/tehnotrack/track17-spring/milestones{/number}","notifications_url":"https://api.github.com/repos/tehnotrack/track17-spring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tehnotrack/track17-spring/labels{/name}","releases_url":"https://api.github.com/repos/tehnotrack/track17-spring/releases{/id}","deployments_url":"https://api.github.com/repos/tehnotrack/track17-spring/deployments","created_at":"2017-02-21T12:20:39Z","updated_at":"2017-02-21T16:30:12Z","pushed_at":"2017-03-18T16:40:38Z","git_url":"git://github.com/tehnotrack/track17-spring.git","ssh_url":"git@github.com:tehnotrack/track17-spring.git","clone_url":"https://github.com/tehnotrack/track17-spring.git","svn_url":"https://github.com/tehnotrack/track17-spring","homepage":null,"size":32,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":54,"forks":45,"open_issues":54,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/68"},"html":{"href":"https://github.com/tehnotrack/track17-spring/pull/68"},"issue":{"href":"https://api.github.com/repos/tehnotrack/track17-spring/issues/68"},"comments":{"href":"https://api.github.com/repos/tehnotrack/track17-spring/issues/68/comments"},"review_comments":{"href":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/68/comments"},"review_comment":{"href":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tehnotrack/track17-spring/pulls/68/commits"},"statuses":{"href":"https://api.github.com/repos/tehnotrack/track17-spring/statuses/41a4bcdbd7dfa293409cab664de09ba63d31814c"}}}}
{"actor":{"display_login":"tehnotrack"}}