diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..1f58a0f
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+generics
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..c20d346
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__junit_junit_4_12.xml b/.idea/libraries/Maven__junit_junit_4_12.xml
new file mode 100644
index 0000000..d411041
--- /dev/null
+++ b/.idea/libraries/Maven__junit_junit_4_12.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
new file mode 100644
index 0000000..f58bbc1
--- /dev/null
+++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..b2526f7
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..ca63f44
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..ea67932
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,621 @@
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 9.0
+
+
+
+
+
+
+
+
+
+
+
+ 9.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/generics.iml b/generics.iml
new file mode 100644
index 0000000..9717c26
--- /dev/null
+++ b/generics.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/MyArrayList.java b/src/main/java/MyArrayList.java
new file mode 100644
index 0000000..4adaee3
--- /dev/null
+++ b/src/main/java/MyArrayList.java
@@ -0,0 +1,91 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Objects;
+
+public class MyArrayList {
+ private T[] myArray;
+
+ public MyArrayList() {
+ this.myArray = (T[]) new Object[0];
+ }
+
+ public MyArrayList(int size) {
+ this.myArray = (T[]) new Object[size];
+ }
+
+ public int size() {
+ return this.myArray.length;
+ }
+
+ public T get(int index) {
+ return this.myArray[index];
+ }
+
+ public T[] toArray() {
+ T[] newArray = (T[])new Object[this.size()];
+ for(int i = 0; i < this.size(); i++){
+ newArray[i] = this.get(i);
+ }
+ return newArray;
+ }
+
+ public void add(T element) {
+ T[] addArray = Arrays.copyOf(this.myArray, this.myArray.length + 1);
+ addArray[addArray.length - 1] = element;
+ this.myArray = addArray;
+ }
+
+ public void addToIndex(int index, T element) {
+ T[] addArray = Arrays.copyOf(this.myArray, this.myArray.length + 1);
+ addArray[index++] = element;
+ this.myArray = addArray;
+ }
+
+ public void remove(T element) {
+ if (!contains(element)) {
+ this.myArray = Arrays.copyOf(this.myArray, this.myArray.length);
+ } else {
+ T[] newArray = Arrays.copyOf(this.myArray, this.myArray.length - 1);
+ int removeIndex = indexOf(element);
+ for (int i = removeIndex; i < myArray.length - 1; i++) {
+ newArray[i] = myArray[i + 1];
+ }
+ this.myArray = newArray;
+ }
+ }
+
+ public void clear() {
+ this.myArray = (T[]) new Object[0];
+ }
+
+ public boolean contains(T element) {
+ for (int i = 0; i < myArray.length; i++) {
+ if (this.myArray[i].equals(element)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean empty() {
+ int count = 0;
+ for (int i = 0; i < myArray.length; i++) {
+ count++;
+ }
+ if (count == 0) {
+ return true;
+ }
+ return false;
+ }
+
+ public Integer indexOf(T element) {
+ int count = 0;
+ for (int i = 0; i < myArray.length; i++) {
+ if (myArray[i].equals(element)) {
+ return count;
+ }
+ count++;
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/MySet.java b/src/main/java/MySet.java
new file mode 100644
index 0000000..7d9d91c
--- /dev/null
+++ b/src/main/java/MySet.java
@@ -0,0 +1,45 @@
+import java.util.Arrays;
+
+public class MySet {
+
+ MyArrayList mySet;
+
+ public MySet() {
+ mySet = new MyArrayList<>();
+ }
+
+ public MySet(int size) {
+ this.mySet = new MyArrayList<>(size);
+ }
+
+ public T get(int index) {
+ return mySet.get(index);
+ }
+
+ public T[] toArray() {
+ return mySet.toArray();
+ }
+
+ public void add(T element) {
+ if (!mySet.contains(element)) {
+ mySet.add(element);
+ }
+ }
+
+ public void remove(T element) {
+ this.mySet.remove(element);
+ }
+
+ public void clear() {
+ this.mySet.clear();
+ }
+
+ public boolean contains(T element) {
+ return this.mySet.contains(element);
+ }
+
+ public boolean empty() {
+ return this.mySet.empty();
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/java/MyArrayListTest.java b/src/test/java/MyArrayListTest.java
new file mode 100644
index 0000000..009dcdf
--- /dev/null
+++ b/src/test/java/MyArrayListTest.java
@@ -0,0 +1,127 @@
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Objects;
+
+import static org.junit.Assert.*;
+
+public class MyArrayListTest {
+
+ @Test
+ public void size() {
+ //Given
+ MyArrayList arrayListTest = new MyArrayList<>();
+ arrayListTest.add(1);
+ //When
+ Integer actual = arrayListTest.size();
+ Integer expected = 1;
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void toArray() {
+ //Given
+ MyArrayList arrayListTest = new MyArrayList<>();
+ arrayListTest.add(3);
+ arrayListTest.add(8);
+ arrayListTest.add(9);
+ //When
+ Object[] actual = arrayListTest.toArray();
+ Object[] expected = {3,8,9};
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void add() {
+ //Given
+ MyArrayList arrayListTest = new MyArrayList<>();
+ arrayListTest.add(1);
+ arrayListTest.add(1);
+ //When
+ Integer actual = arrayListTest.size();
+ Integer expected = 2;
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void addToIndexTest() {
+ //Given
+ MyArrayList arrayListTest = new MyArrayList<>();
+ arrayListTest.add(1);
+ arrayListTest.add(1);
+ arrayListTest.addToIndex(1, 1);
+ //When
+ Integer actual = arrayListTest.size();
+ Integer expected = 3;
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void remove() {
+ //Given
+ MyArrayList arrayListTest = new MyArrayList<>();
+ arrayListTest.add(3);
+ arrayListTest.add(8);
+ arrayListTest.add(9);
+ arrayListTest.remove(9);
+ //When
+ Object[] actual = arrayListTest.toArray();
+ Object[] expected = {3,8};
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void clear() {
+ //Given
+ MyArrayList arrayListTest = new MyArrayList<>();
+ arrayListTest.add(1);
+ arrayListTest.clear();
+ //When
+ Integer actual = arrayListTest.size();
+ Integer expected = 0;
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void contains() {
+ //Given
+ MyArrayList arrayListTest = new MyArrayList<>();
+ arrayListTest.add(1);
+ arrayListTest.add(4);
+ arrayListTest.add(8);
+ //When
+ Boolean actual = arrayListTest.contains(8);
+ //Then
+ Assert.assertTrue(actual);
+ }
+
+ @Test
+ public void empty() {
+ //Given
+ MyArrayList arrayListTest = new MyArrayList<>();
+ //When
+ Boolean actual = arrayListTest.empty();
+ //Then
+ Assert.assertTrue(actual);
+ }
+
+ @Test
+ public void indexOf() {
+ //Given
+ MyArrayList arrayListTest = new MyArrayList<>();
+ arrayListTest.add(1);
+ arrayListTest.add(4);
+ arrayListTest.add(7);
+ //When
+ Integer actual = arrayListTest.indexOf(7);
+ Integer expected = 2;
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/MySetTest.java b/src/test/java/MySetTest.java
new file mode 100644
index 0000000..e459806
--- /dev/null
+++ b/src/test/java/MySetTest.java
@@ -0,0 +1,99 @@
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class MySetTest {
+
+ @Test
+ public void get() {
+ //Given
+ MySet mySetTest = new MySet<>();
+ mySetTest.add(1);
+ mySetTest.add(4);
+ mySetTest.add(9);
+ //When
+ Integer actual = mySetTest.get(1);
+ Integer expected = 4;
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void toArray() {
+ //Given
+ MySet mySetTest = new MySet<>();
+ mySetTest.add(1);
+ mySetTest.add(4);
+ mySetTest.add(9);
+ //When
+ Object[] actual = mySetTest.toArray();
+ Object[] expected = {1, 4, 9};
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void add() {
+ //Given
+ MySet mySetTest = new MySet<>();
+ mySetTest.add(1);
+ mySetTest.add(1);
+ //When
+ Object[] actual = mySetTest.toArray();
+ Object[] expected = {1};
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void remove() {
+ //Given
+ MySet mySetTest = new MySet<>();
+ mySetTest.add(1);
+ mySetTest.add(1);
+ mySetTest.remove(1);
+ //When
+ Object[] actual = mySetTest.toArray();
+ Object[] expected = {};
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void clear() {
+ //Given
+ MySet mySetTest = new MySet<>();
+ mySetTest.add(1);
+ mySetTest.add(1);
+ mySetTest.clear();
+ //When
+ Object[] actual = mySetTest.toArray();
+ Object[] expected = {};
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void contains() {
+ //Given
+ MySet mySetTest = new MySet<>();
+ mySetTest.add(2);
+ mySetTest.add(3);
+ mySetTest.add(4);
+ //When
+ Boolean actual = mySetTest.contains(4);
+ //Then
+ Assert.assertTrue(actual);
+ }
+
+ @Test
+ public void empty() {
+ //Given
+ MySet mySetTest = new MySet<>();
+ //When
+ Boolean actual = mySetTest.empty();
+ //Then
+ Assert.assertTrue(actual);
+ }
+}
\ No newline at end of file