payload: {"action":"created","comment":{"url":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/comments/359309796","pull_request_review_id":333923496,"id":359309796,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM1OTMwOTc5Ng==","diff_hunk":"@@ -6,19 +6,92 @@\n  * За бажанням можна реалізувати інші методи інтрефейсу Map.</p>\n  */\n public class MyHashMap<K, V> implements MyMap<K, V> {\n+    static final int DEFAULT_INITIAL_CAPACITY = 16;\n+    static final float DEFAULT_LOAD_FACTOR = 0.75F;\n+    private int bucket;\n+    private Node<K, V>[] buckets;\n+    private int size = 0;\n+\n+    public MyHashMap() {\n+        buckets = new Node[DEFAULT_INITIAL_CAPACITY];\n+    }\n \n     @Override\n     public void put(K key, V value) {\n-\n+        resize();\n+        int bucketIndex = defineBucket(key);\n+        Node<K, V> now = buckets[bucketIndex];\n+        if (now == null) {\n+            buckets[bucketIndex] = new Node<>(key, value, null);\n+            size++;\n+            return;\n+        }\n+        while (now != null) {\n+            if (key == now.key || key != null && key.equals(now.key)) {\n+                now.value = value;\n+                return;\n+            }\n+            if (now.next == null) {\n+                now.next = new Node<>(key, value, null);\n+                break;\n+            }\n+            now = now.next;\n+        }\n+        size++;\n     }\n \n     @Override\n     public V getValue(K key) {\n+        if (key == null) {\n+            return buckets[0].value;\n+        }\n+        int bucketIndex = defineBucket(key);\n+        Node<K, V> lookFor = buckets[bucketIndex];\n+        while (lookFor != null) {\n+            if (key == lookFor.key || key != null && key.equals(lookFor.key)) {\n+                return lookFor.value;\n+            }\n+            lookFor = lookFor.next;\n+        }\n         return null;\n     }\n \n     @Override\n     public int getSize() {\n-        return 0;\n+        return size;\n+    }\n+\n+    private int defineBucket(K key) {\n+        return (key == null) ? 0 : Math.abs(key.hashCode() % buckets.length - 1);\n+    }\n+\n+    private void resize() {\n+        if (size >= (int) buckets.length * DEFAULT_LOAD_FACTOR) {\n+            Node<K, V>[] oldBuckets = buckets;\n+            buckets = new Node[oldBuckets.length * 2]; //here have had a problem with <K, V>. Why?\n+            size = 0;\n+            for (int i = 0; i < oldBuckets.length; i++) {\n+                if (oldBuckets[i] == null) {\n+                    continue;\n+                }\n+                Node<K, V> toAddAgain = oldBuckets[i];\n+                while (toAddAgain != null) {\n+                    put(toAddAgain.key, toAddAgain.value);\n+                    toAddAgain = toAddAgain.next;\n+                }\n+            }\n+        }\n+    }\n+\n+    class Node<K, V> {\n+        private K key;\n+        private V value;\n+        private Node<K, V> next;\n+\n+        Node(K key, V value, Node<K, V> next) {","path":"src/main/java/core/basesyntax/MyHashMap.java","position":88,"original_position":88,"commit_id":"707d99ae8596039e675569880c516454a8dc2a66","original_commit_id":"707d99ae8596039e675569880c516454a8dc2a66","user":{"login":"Sofasmile","id":36365171,"node_id":"MDQ6VXNlcjM2MzY1MTcx","avatar_url":"https://avatars2.githubusercontent.com/u/36365171?v=4","gravatar_id":"","url":"https://api.github.com/users/Sofasmile","html_url":"https://github.com/Sofasmile","followers_url":"https://api.github.com/users/Sofasmile/followers","following_url":"https://api.github.com/users/Sofasmile/following{/other_user}","gists_url":"https://api.github.com/users/Sofasmile/gists{/gist_id}","starred_url":"https://api.github.com/users/Sofasmile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sofasmile/subscriptions","organizations_url":"https://api.github.com/users/Sofasmile/orgs","repos_url":"https://api.github.com/users/Sofasmile/repos","events_url":"https://api.github.com/users/Sofasmile/events{/privacy}","received_events_url":"https://api.github.com/users/Sofasmile/received_events","type":"User","site_admin":false},"body":"модифікатор","created_at":"2019-12-18T12:09:35Z","updated_at":"2019-12-18T12:09:56Z","html_url":"https://github.com/mate-academy/jv-hash-map/pull/50#discussion_r359309796","pull_request_url":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/50","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/comments/359309796"},"html":{"href":"https://github.com/mate-academy/jv-hash-map/pull/50#discussion_r359309796"},"pull_request":{"href":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/50"}}},"pull_request":{"url":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/50","id":354564291,"node_id":"MDExOlB1bGxSZXF1ZXN0MzU0NTY0Mjkx","html_url":"https://github.com/mate-academy/jv-hash-map/pull/50","diff_url":"https://github.com/mate-academy/jv-hash-map/pull/50.diff","patch_url":"https://github.com/mate-academy/jv-hash-map/pull/50.patch","issue_url":"https://api.github.com/repos/mate-academy/jv-hash-map/issues/50","number":50,"state":"open","locked":false,"title":"Done","user":{"login":"IegorSoboliev","id":58389602,"node_id":"MDQ6VXNlcjU4Mzg5NjAy","avatar_url":"https://avatars3.githubusercontent.com/u/58389602?v=4","gravatar_id":"","url":"https://api.github.com/users/IegorSoboliev","html_url":"https://github.com/IegorSoboliev","followers_url":"https://api.github.com/users/IegorSoboliev/followers","following_url":"https://api.github.com/users/IegorSoboliev/following{/other_user}","gists_url":"https://api.github.com/users/IegorSoboliev/gists{/gist_id}","starred_url":"https://api.github.com/users/IegorSoboliev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IegorSoboliev/subscriptions","organizations_url":"https://api.github.com/users/IegorSoboliev/orgs","repos_url":"https://api.github.com/users/IegorSoboliev/repos","events_url":"https://api.github.com/users/IegorSoboliev/events{/privacy}","received_events_url":"https://api.github.com/users/IegorSoboliev/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-12-18T11:25:32Z","updated_at":"2019-12-18T12:09:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc8acc01b178b37d29b1b5085c29f984a001746f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/50/commits","review_comments_url":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/50/comments","review_comment_url":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mate-academy/jv-hash-map/issues/50/comments","statuses_url":"https://api.github.com/repos/mate-academy/jv-hash-map/statuses/707d99ae8596039e675569880c516454a8dc2a66","head":{"label":"IegorSoboliev:solutionSoboliev","ref":"solutionSoboliev","sha":"707d99ae8596039e675569880c516454a8dc2a66","user":{"login":"IegorSoboliev","id":58389602,"node_id":"MDQ6VXNlcjU4Mzg5NjAy","avatar_url":"https://avatars3.githubusercontent.com/u/58389602?v=4","gravatar_id":"","url":"https://api.github.com/users/IegorSoboliev","html_url":"https://github.com/IegorSoboliev","followers_url":"https://api.github.com/users/IegorSoboliev/followers","following_url":"https://api.github.com/users/IegorSoboliev/following{/other_user}","gists_url":"https://api.github.com/users/IegorSoboliev/gists{/gist_id}","starred_url":"https://api.github.com/users/IegorSoboliev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IegorSoboliev/subscriptions","organizations_url":"https://api.github.com/users/IegorSoboliev/orgs","repos_url":"https://api.github.com/users/IegorSoboliev/repos","events_url":"https://api.github.com/users/IegorSoboliev/events{/privacy}","received_events_url":"https://api.github.com/users/IegorSoboliev/received_events","type":"User","site_admin":false},"repo":{"id":228378667,"node_id":"MDEwOlJlcG9zaXRvcnkyMjgzNzg2Njc=","name":"jv-hash-map","full_name":"IegorSoboliev/jv-hash-map","private":false,"owner":{"login":"IegorSoboliev","id":58389602,"node_id":"MDQ6VXNlcjU4Mzg5NjAy","avatar_url":"https://avatars3.githubusercontent.com/u/58389602?v=4","gravatar_id":"","url":"https://api.github.com/users/IegorSoboliev","html_url":"https://github.com/IegorSoboliev","followers_url":"https://api.github.com/users/IegorSoboliev/followers","following_url":"https://api.github.com/users/IegorSoboliev/following{/other_user}","gists_url":"https://api.github.com/users/IegorSoboliev/gists{/gist_id}","starred_url":"https://api.github.com/users/IegorSoboliev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IegorSoboliev/subscriptions","organizations_url":"https://api.github.com/users/IegorSoboliev/orgs","repos_url":"https://api.github.com/users/IegorSoboliev/repos","events_url":"https://api.github.com/users/IegorSoboliev/events{/privacy}","received_events_url":"https://api.github.com/users/IegorSoboliev/received_events","type":"User","site_admin":false},"html_url":"https://github.com/IegorSoboliev/jv-hash-map","description":null,"fork":true,"url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map","forks_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/forks","keys_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/teams","hooks_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/hooks","issue_events_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/issues/events{/number}","events_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/events","assignees_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/assignees{/user}","branches_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/branches{/branch}","tags_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/tags","blobs_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/git/refs{/sha}","trees_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/statuses/{sha}","languages_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/languages","stargazers_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/stargazers","contributors_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/contributors","subscribers_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/subscribers","subscription_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/subscription","commits_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/commits{/sha}","git_commits_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/git/commits{/sha}","comments_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/comments{/number}","issue_comment_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/issues/comments{/number}","contents_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/contents/{+path}","compare_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/merges","archive_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/downloads","issues_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/issues{/number}","pulls_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/pulls{/number}","milestones_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/milestones{/number}","notifications_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/labels{/name}","releases_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/releases{/id}","deployments_url":"https://api.github.com/repos/IegorSoboliev/jv-hash-map/deployments","created_at":"2019-12-16T12:06:49Z","updated_at":"2019-12-16T12:06:51Z","pushed_at":"2019-12-18T11:24:12Z","git_url":"git://github.com/IegorSoboliev/jv-hash-map.git","ssh_url":"git@github.com:IegorSoboliev/jv-hash-map.git","clone_url":"https://github.com/IegorSoboliev/jv-hash-map.git","svn_url":"https://github.com/IegorSoboliev/jv-hash-map","homepage":null,"size":14,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"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":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mate-academy:master","ref":"master","sha":"a35476ea0d4a3fc86120311faba1697774d7214c","user":{"login":"mate-academy","id":28379899,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4Mzc5ODk5","avatar_url":"https://avatars1.githubusercontent.com/u/28379899?v=4","gravatar_id":"","url":"https://api.github.com/users/mate-academy","html_url":"https://github.com/mate-academy","followers_url":"https://api.github.com/users/mate-academy/followers","following_url":"https://api.github.com/users/mate-academy/following{/other_user}","gists_url":"https://api.github.com/users/mate-academy/gists{/gist_id}","starred_url":"https://api.github.com/users/mate-academy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mate-academy/subscriptions","organizations_url":"https://api.github.com/users/mate-academy/orgs","repos_url":"https://api.github.com/users/mate-academy/repos","events_url":"https://api.github.com/users/mate-academy/events{/privacy}","received_events_url":"https://api.github.com/users/mate-academy/received_events","type":"Organization","site_admin":false},"repo":{"id":204894229,"node_id":"MDEwOlJlcG9zaXRvcnkyMDQ4OTQyMjk=","name":"jv-hash-map","full_name":"mate-academy/jv-hash-map","private":false,"owner":{"login":"mate-academy","id":28379899,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4Mzc5ODk5","avatar_url":"https://avatars1.githubusercontent.com/u/28379899?v=4","gravatar_id":"","url":"https://api.github.com/users/mate-academy","html_url":"https://github.com/mate-academy","followers_url":"https://api.github.com/users/mate-academy/followers","following_url":"https://api.github.com/users/mate-academy/following{/other_user}","gists_url":"https://api.github.com/users/mate-academy/gists{/gist_id}","starred_url":"https://api.github.com/users/mate-academy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mate-academy/subscriptions","organizations_url":"https://api.github.com/users/mate-academy/orgs","repos_url":"https://api.github.com/users/mate-academy/repos","events_url":"https://api.github.com/users/mate-academy/events{/privacy}","received_events_url":"https://api.github.com/users/mate-academy/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mate-academy/jv-hash-map","description":null,"fork":false,"url":"https://api.github.com/repos/mate-academy/jv-hash-map","forks_url":"https://api.github.com/repos/mate-academy/jv-hash-map/forks","keys_url":"https://api.github.com/repos/mate-academy/jv-hash-map/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mate-academy/jv-hash-map/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mate-academy/jv-hash-map/teams","hooks_url":"https://api.github.com/repos/mate-academy/jv-hash-map/hooks","issue_events_url":"https://api.github.com/repos/mate-academy/jv-hash-map/issues/events{/number}","events_url":"https://api.github.com/repos/mate-academy/jv-hash-map/events","assignees_url":"https://api.github.com/repos/mate-academy/jv-hash-map/assignees{/user}","branches_url":"https://api.github.com/repos/mate-academy/jv-hash-map/branches{/branch}","tags_url":"https://api.github.com/repos/mate-academy/jv-hash-map/tags","blobs_url":"https://api.github.com/repos/mate-academy/jv-hash-map/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mate-academy/jv-hash-map/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mate-academy/jv-hash-map/git/refs{/sha}","trees_url":"https://api.github.com/repos/mate-academy/jv-hash-map/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mate-academy/jv-hash-map/statuses/{sha}","languages_url":"https://api.github.com/repos/mate-academy/jv-hash-map/languages","stargazers_url":"https://api.github.com/repos/mate-academy/jv-hash-map/stargazers","contributors_url":"https://api.github.com/repos/mate-academy/jv-hash-map/contributors","subscribers_url":"https://api.github.com/repos/mate-academy/jv-hash-map/subscribers","subscription_url":"https://api.github.com/repos/mate-academy/jv-hash-map/subscription","commits_url":"https://api.github.com/repos/mate-academy/jv-hash-map/commits{/sha}","git_commits_url":"https://api.github.com/repos/mate-academy/jv-hash-map/git/commits{/sha}","comments_url":"https://api.github.com/repos/mate-academy/jv-hash-map/comments{/number}","issue_comment_url":"https://api.github.com/repos/mate-academy/jv-hash-map/issues/comments{/number}","contents_url":"https://api.github.com/repos/mate-academy/jv-hash-map/contents/{+path}","compare_url":"https://api.github.com/repos/mate-academy/jv-hash-map/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mate-academy/jv-hash-map/merges","archive_url":"https://api.github.com/repos/mate-academy/jv-hash-map/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mate-academy/jv-hash-map/downloads","issues_url":"https://api.github.com/repos/mate-academy/jv-hash-map/issues{/number}","pulls_url":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls{/number}","milestones_url":"https://api.github.com/repos/mate-academy/jv-hash-map/milestones{/number}","notifications_url":"https://api.github.com/repos/mate-academy/jv-hash-map/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mate-academy/jv-hash-map/labels{/name}","releases_url":"https://api.github.com/repos/mate-academy/jv-hash-map/releases{/id}","deployments_url":"https://api.github.com/repos/mate-academy/jv-hash-map/deployments","created_at":"2019-08-28T09:20:52Z","updated_at":"2019-09-23T14:27:09Z","pushed_at":"2019-12-18T11:46:22Z","git_url":"git://github.com/mate-academy/jv-hash-map.git","ssh_url":"git@github.com:mate-academy/jv-hash-map.git","clone_url":"https://github.com/mate-academy/jv-hash-map.git","svn_url":"https://github.com/mate-academy/jv-hash-map","homepage":null,"size":14,"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":49,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":21,"license":null,"forks":49,"open_issues":21,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/50"},"html":{"href":"https://github.com/mate-academy/jv-hash-map/pull/50"},"issue":{"href":"https://api.github.com/repos/mate-academy/jv-hash-map/issues/50"},"comments":{"href":"https://api.github.com/repos/mate-academy/jv-hash-map/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mate-academy/jv-hash-map/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/mate-academy/jv-hash-map/statuses/707d99ae8596039e675569880c516454a8dc2a66"}},"author_association":"NONE"}}
other: {"actor":{"display_login":"Sofasmile"}}