{"action":"created","comment":{"url":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/comments/214711125","pull_request_review_id":151819814,"id":214711125,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDcxMTEyNQ==","diff_hunk":"@@ -0,0 +1,196 @@\n+package hr.fer.zemris.java.custom.collections;\n+\n+/**\n+ * Resizable array-backed indexed collection.\n+ * @author Mislav Matijević.\n+ * @version 1.0\n+ */\n+public class ArrayBackedIndexedCollection {\n+  \n+  private int size;\n+  private int capacity;\n+  private Object[] elements;\n+\n+  /**\n+   * Default constructor.\n+   */\n+  public ArrayBackedIndexedCollection() {\n+    capacity = 16;\n+    elements = new Object[16];\n+    size = 0;\n+  }\n+\n+  /**\n+   * Constructor with greater than zero initial capacity.\n+   * @param initialCapacity - given initial capacity.\n+   */\n+  public ArrayBackedIndexedCollection(int initialCapacity) {\n+    if (initialCapacity < 1) {\n+      throw new IllegalArgumentException(\"initial capacity has to be greater then 0\");\n+    }\n+    capacity = initialCapacity;\n+    elements = new Object[capacity];\n+    size = 0;\n+  }\n+\n+  /**\n+   * Method checks if the collection is empty. \n+   * @return boolean expression\n+   */\n+  public boolean isEmpty() {\n+    if (size > 0) {\n+      return false;\n+    }\n+    return true;\n+  }\n+\n+  /**\n+   * Method returns size of the collection.\n+   * @return size of collection.\n+   */\n+  public int size() {\n+    return size;\n+  }\n+\n+  /**\n+   * Method adds object to the collection.\n+   * @param value - object to add to collection.\n+   */\n+  public void add(Object value) {\n+    if (value == null) {\n+      throw new IllegalArgumentException(\"NULL value not allowed\");\n+    }\n+    if (size == capacity) {\n+      Object[] temp = new Object[capacity * 2];\n+      for (int i = 0; i < size; i++) {\n+        temp[i] = elements[i];\n+      }\n+      temp[size] = value;\n+      capacity *= 2;\n+      size++;\n+      elements = temp;\n+    } else {\n+      elements[size] = value;\n+      size++;\n+    }\n+  }\n+\n+  /**\n+   * Method returns object at a given index.\n+   * @param index - position of the object in collection.\n+   * @return object\n+   */\n+  public Object get(int index) {\n+    if (index < 0 || index > size - 1) {\n+      throw new IndexOutOfBoundsException(\"index out of bound\");\n+    }\n+    Object temp = elements[index];\n+    return temp;\n+  }\n+\n+  /**\n+   * Method removes object at the given index from the collection.\n+   * @param index - position of the object in collection.\n+   */\n+  public void remove(int index) {\n+\n+    if (index < 0 || index > size - 1) {\n+      throw new IndexOutOfBoundsException(\"index out of bound\");\n+    }\n+\n+    Object[] temp = new Object[capacity];\n+    for (int i = 0; i < index; i++) {\n+      temp[i] = elements[i];\n+    }\n+    \n+    for (int i = index; i < size - 1; i++) {\n+      temp[i] = elements[i + 1];\n+    }\n+    elements = temp;\n+    size--;\n+  }\n+\n+  /**\n+   * Method inserts object at he given position in the collection.\n+   * @param value - object to add to collection.\n+   * @param position - position of the object in collection.\n+   */\n+  public void insert(Object value, int position) {\n+    if (position < 0 || position > size) {\n+      throw new IllegalArgumentException(\"position cannot be less then 0 or greater then size\");\n+    }\n+    if (size == capacity) {\n+      Object[] temp = new Object[capacity * 2];\n+      for (int i = 0; i < position; i++) {\n+        temp[i] = elements[i];\n+      }\n+      temp[position] = value;\n+      for (int i = position + 1; i < size + 1; i++) {\n+        temp[i] = elements[i - 1];\n+      }\n+      capacity *= 2;\n+      size++;\n+      elements = temp;\n+    } else {\n+      for (int i = size - 1; i >= position; i--) {\n+        elements[i + 1] = elements[i];\n+      }\n+      elements[position] = value;\n+      size++;\n+    }\n+  }\n+\n+  /**\n+   * Method returns the first index of the given object or it returns -1 if the collection doesn't\n+   * contain the object.\n+   * @param value - object in collection.\n+   * @return - index of the object.\n+   */\n+  public int indexOf(Object value) {\n+    for (int i = 0; i < size; i++) {\n+      if (value.equals(elements[i])) {\n+        return i;\n+      }\n+    }\n+    return -1;\n+  }\n+\n+  /**\n+   * Method checks if the collection contains a given object.\n+   * @param value - object in collection.\n+   * @return\n+   */\n+  public boolean contains(Object value) {\n+    for (int i = 0; i < size; i++) {\n+      if (value.equals(elements[i])) {\n+        return true;\n+      }\n+    }\n+    return false;\n+  }\n+\n+  /**\n+   * Method clears the collection.\n+   */\n+  public void clear() {\n+    elements = new Object[capacity];","path":"opjj_lesson_1_problem_1/src/hr/fer/zemris/java/custom/collections/ArrayBackedIndexedCollection.java","position":176,"original_position":176,"commit_id":"6c9816671349d6f66ad5c577be073a6333845ef1","original_commit_id":"6c9816671349d6f66ad5c577be073a6333845ef1","user":{"login":"ikatanic","id":7190896,"node_id":"MDQ6VXNlcjcxOTA4OTY=","avatar_url":"https://avatars2.githubusercontent.com/u/7190896?v=4","gravatar_id":"","url":"https://api.github.com/users/ikatanic","html_url":"https://github.com/ikatanic","followers_url":"https://api.github.com/users/ikatanic/followers","following_url":"https://api.github.com/users/ikatanic/following{/other_user}","gists_url":"https://api.github.com/users/ikatanic/gists{/gist_id}","starred_url":"https://api.github.com/users/ikatanic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikatanic/subscriptions","organizations_url":"https://api.github.com/users/ikatanic/orgs","repos_url":"https://api.github.com/users/ikatanic/repos","events_url":"https://api.github.com/users/ikatanic/events{/privacy}","received_events_url":"https://api.github.com/users/ikatanic/received_events","type":"User","site_admin":false},"body":"Ovo bi isto tehnički trebalo bez nove alokacije memorije. Alociranje nove memorije je sporo i kad je jednostanvo izbjeć, treba izbjeć. Tako da možeš samo postavit sve elemente na `null` ako želiš. A čini mi se da možda ni to nije nužno, jer ionako je `size == 0` pa ignoriraš sve vrijednosti, šta god one bile.","created_at":"2018-09-03T14:45:17Z","updated_at":"2018-09-03T14:48:59Z","html_url":"https://github.com/CroEntrain/mislav-opjj/pull/1#discussion_r214711125","pull_request_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/1","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/comments/214711125"},"html":{"href":"https://github.com/CroEntrain/mislav-opjj/pull/1#discussion_r214711125"},"pull_request":{"href":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/1","id":212592716,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyNTkyNzE2","html_url":"https://github.com/CroEntrain/mislav-opjj/pull/1","diff_url":"https://github.com/CroEntrain/mislav-opjj/pull/1.diff","patch_url":"https://github.com/CroEntrain/mislav-opjj/pull/1.patch","issue_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/issues/1","number":1,"state":"open","locked":false,"title":"prvi problem","user":{"login":"mislav1","id":22578454,"node_id":"MDQ6VXNlcjIyNTc4NDU0","avatar_url":"https://avatars2.githubusercontent.com/u/22578454?v=4","gravatar_id":"","url":"https://api.github.com/users/mislav1","html_url":"https://github.com/mislav1","followers_url":"https://api.github.com/users/mislav1/followers","following_url":"https://api.github.com/users/mislav1/following{/other_user}","gists_url":"https://api.github.com/users/mislav1/gists{/gist_id}","starred_url":"https://api.github.com/users/mislav1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mislav1/subscriptions","organizations_url":"https://api.github.com/users/mislav1/orgs","repos_url":"https://api.github.com/users/mislav1/repos","events_url":"https://api.github.com/users/mislav1/events{/privacy}","received_events_url":"https://api.github.com/users/mislav1/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-09-02T13:25:33Z","updated_at":"2018-09-03T14:48:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f31dcff79ec6727ef5dfc14411af1697658a3bf8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/1/commits","review_comments_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/1/comments","review_comment_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/issues/1/comments","statuses_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/statuses/6c9816671349d6f66ad5c577be073a6333845ef1","head":{"label":"CroEntrain:opjj_lesson_1_problem_1","ref":"opjj_lesson_1_problem_1","sha":"6c9816671349d6f66ad5c577be073a6333845ef1","user":{"login":"CroEntrain","id":42889794,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyODg5Nzk0","avatar_url":"https://avatars3.githubusercontent.com/u/42889794?v=4","gravatar_id":"","url":"https://api.github.com/users/CroEntrain","html_url":"https://github.com/CroEntrain","followers_url":"https://api.github.com/users/CroEntrain/followers","following_url":"https://api.github.com/users/CroEntrain/following{/other_user}","gists_url":"https://api.github.com/users/CroEntrain/gists{/gist_id}","starred_url":"https://api.github.com/users/CroEntrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CroEntrain/subscriptions","organizations_url":"https://api.github.com/users/CroEntrain/orgs","repos_url":"https://api.github.com/users/CroEntrain/repos","events_url":"https://api.github.com/users/CroEntrain/events{/privacy}","received_events_url":"https://api.github.com/users/CroEntrain/received_events","type":"Organization","site_admin":false},"repo":{"id":147071750,"node_id":"MDEwOlJlcG9zaXRvcnkxNDcwNzE3NTA=","name":"mislav-opjj","full_name":"CroEntrain/mislav-opjj","owner":{"login":"CroEntrain","id":42889794,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyODg5Nzk0","avatar_url":"https://avatars3.githubusercontent.com/u/42889794?v=4","gravatar_id":"","url":"https://api.github.com/users/CroEntrain","html_url":"https://github.com/CroEntrain","followers_url":"https://api.github.com/users/CroEntrain/followers","following_url":"https://api.github.com/users/CroEntrain/following{/other_user}","gists_url":"https://api.github.com/users/CroEntrain/gists{/gist_id}","starred_url":"https://api.github.com/users/CroEntrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CroEntrain/subscriptions","organizations_url":"https://api.github.com/users/CroEntrain/orgs","repos_url":"https://api.github.com/users/CroEntrain/repos","events_url":"https://api.github.com/users/CroEntrain/events{/privacy}","received_events_url":"https://api.github.com/users/CroEntrain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CroEntrain/mislav-opjj","description":null,"fork":false,"url":"https://api.github.com/repos/CroEntrain/mislav-opjj","forks_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/forks","keys_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/teams","hooks_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/hooks","issue_events_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/issues/events{/number}","events_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/events","assignees_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/assignees{/user}","branches_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/branches{/branch}","tags_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/tags","blobs_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/git/refs{/sha}","trees_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/statuses/{sha}","languages_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/languages","stargazers_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/stargazers","contributors_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/contributors","subscribers_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/subscribers","subscription_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/subscription","commits_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/commits{/sha}","git_commits_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/git/commits{/sha}","comments_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/comments{/number}","issue_comment_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/issues/comments{/number}","contents_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/contents/{+path}","compare_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/merges","archive_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/downloads","issues_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/issues{/number}","pulls_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls{/number}","milestones_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/milestones{/number}","notifications_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/labels{/name}","releases_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/releases{/id}","deployments_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/deployments","created_at":"2018-09-02T09:28:02Z","updated_at":"2018-09-02T13:06:42Z","pushed_at":"2018-09-03T14:28:37Z","git_url":"git://github.com/CroEntrain/mislav-opjj.git","ssh_url":"git@github.com:CroEntrain/mislav-opjj.git","clone_url":"https://github.com/CroEntrain/mislav-opjj.git","svn_url":"https://github.com/CroEntrain/mislav-opjj","homepage":null,"size":3,"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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"CroEntrain:master","ref":"master","sha":"99c2d83e54bec5f2778d24cdf95cd1c9398fc37a","user":{"login":"CroEntrain","id":42889794,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyODg5Nzk0","avatar_url":"https://avatars3.githubusercontent.com/u/42889794?v=4","gravatar_id":"","url":"https://api.github.com/users/CroEntrain","html_url":"https://github.com/CroEntrain","followers_url":"https://api.github.com/users/CroEntrain/followers","following_url":"https://api.github.com/users/CroEntrain/following{/other_user}","gists_url":"https://api.github.com/users/CroEntrain/gists{/gist_id}","starred_url":"https://api.github.com/users/CroEntrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CroEntrain/subscriptions","organizations_url":"https://api.github.com/users/CroEntrain/orgs","repos_url":"https://api.github.com/users/CroEntrain/repos","events_url":"https://api.github.com/users/CroEntrain/events{/privacy}","received_events_url":"https://api.github.com/users/CroEntrain/received_events","type":"Organization","site_admin":false},"repo":{"id":147071750,"node_id":"MDEwOlJlcG9zaXRvcnkxNDcwNzE3NTA=","name":"mislav-opjj","full_name":"CroEntrain/mislav-opjj","owner":{"login":"CroEntrain","id":42889794,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQyODg5Nzk0","avatar_url":"https://avatars3.githubusercontent.com/u/42889794?v=4","gravatar_id":"","url":"https://api.github.com/users/CroEntrain","html_url":"https://github.com/CroEntrain","followers_url":"https://api.github.com/users/CroEntrain/followers","following_url":"https://api.github.com/users/CroEntrain/following{/other_user}","gists_url":"https://api.github.com/users/CroEntrain/gists{/gist_id}","starred_url":"https://api.github.com/users/CroEntrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CroEntrain/subscriptions","organizations_url":"https://api.github.com/users/CroEntrain/orgs","repos_url":"https://api.github.com/users/CroEntrain/repos","events_url":"https://api.github.com/users/CroEntrain/events{/privacy}","received_events_url":"https://api.github.com/users/CroEntrain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CroEntrain/mislav-opjj","description":null,"fork":false,"url":"https://api.github.com/repos/CroEntrain/mislav-opjj","forks_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/forks","keys_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/teams","hooks_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/hooks","issue_events_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/issues/events{/number}","events_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/events","assignees_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/assignees{/user}","branches_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/branches{/branch}","tags_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/tags","blobs_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/git/refs{/sha}","trees_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/statuses/{sha}","languages_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/languages","stargazers_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/stargazers","contributors_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/contributors","subscribers_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/subscribers","subscription_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/subscription","commits_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/commits{/sha}","git_commits_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/git/commits{/sha}","comments_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/comments{/number}","issue_comment_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/issues/comments{/number}","contents_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/contents/{+path}","compare_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/merges","archive_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/downloads","issues_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/issues{/number}","pulls_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls{/number}","milestones_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/milestones{/number}","notifications_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/labels{/name}","releases_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/releases{/id}","deployments_url":"https://api.github.com/repos/CroEntrain/mislav-opjj/deployments","created_at":"2018-09-02T09:28:02Z","updated_at":"2018-09-02T13:06:42Z","pushed_at":"2018-09-03T14:28:37Z","git_url":"git://github.com/CroEntrain/mislav-opjj.git","ssh_url":"git@github.com:CroEntrain/mislav-opjj.git","clone_url":"https://github.com/CroEntrain/mislav-opjj.git","svn_url":"https://github.com/CroEntrain/mislav-opjj","homepage":null,"size":3,"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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/1"},"html":{"href":"https://github.com/CroEntrain/mislav-opjj/pull/1"},"issue":{"href":"https://api.github.com/repos/CroEntrain/mislav-opjj/issues/1"},"comments":{"href":"https://api.github.com/repos/CroEntrain/mislav-opjj/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CroEntrain/mislav-opjj/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/CroEntrain/mislav-opjj/statuses/6c9816671349d6f66ad5c577be073a6333845ef1"}},"author_association":"NONE"}}
{"actor":{"display_login":"ikatanic"}}