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/dictionaries/ahsonchaudhary.xml b/.idea/dictionaries/ahsonchaudhary.xml
new file mode 100644
index 0000000..2533f9c
--- /dev/null
+++ b/.idea/dictionaries/ahsonchaudhary.xml
@@ -0,0 +1,3 @@
+
+
+
\ 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..d30d09e
--- /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..ba71ad1
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,1044 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Android > Lint > Correctness
+
+
+ Android > Lint > Performance
+
+
+ Android Lint for Kotlin
+
+
+ Plugin DevKit
+
+
+
+
+ Android
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1520541214218
+
+
+ 1520541214218
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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..6e47b43
--- /dev/null
+++ b/src/main/java/MyArrayList.java
@@ -0,0 +1,174 @@
+import java.util.Arrays;
+import java.lang.reflect.Array;
+
+public class MyArrayList
+{
+ protected T[] inputArray;
+
+
+
+ //Constructors
+ public MyArrayList()
+ {
+ this.inputArray = (T[]) new Object[0];
+ }
+
+ public MyArrayList(int size)
+ {
+ this.inputArray = (T[]) new Object[size];
+ }
+
+ //adds
+ public void add(T element)
+ {
+
+ T[] finalArray = Arrays.copyOf(inputArray, inputArray.length + 1);
+ finalArray[finalArray.length-1]= element;
+ this.inputArray = finalArray;
+
+ }
+
+ public void addAnywhere(T value, int index)
+ {
+
+ T[] otherArray = Arrays.copyOf(inputArray, inputArray.length + 1);
+
+
+ if (otherArray[index].equals(null))
+ {
+ otherArray[index] = value;
+ }
+ else
+ {
+ Integer count = inputArray.length;
+
+ while (index < count)
+ {
+ otherArray[count] = otherArray[count - 1];
+ count--;
+ }
+
+ otherArray[index] = value;
+
+ }
+
+ inputArray = otherArray;
+
+ }
+
+ //size
+ public Integer size()
+ {
+ return this.inputArray.length;
+ }
+
+ //get
+ public T get(int index)
+ {
+ return this.inputArray[index];
+ }
+
+ //set
+ public void set(int index, T element)
+ {
+ inputArray[index] = element;
+ }
+
+ //clear
+ public void clear()
+ {
+ inputArray = Arrays.copyOf(inputArray, 0);
+ }
+
+ //indexOf
+ public Integer indexOf(T element)
+ {
+ for (int i = 0; i < inputArray.length; i++)
+ {
+ if (element.equals(inputArray[i]))
+ {
+ return i;
+ }
+ }
+ return null;
+ }
+
+ //contains
+ public boolean contains(T element)
+ {
+ for (int i = 0; i < inputArray.length; i++)
+ {
+ if (element.equals(inputArray[i]))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ //remove
+ public void remove(T element)
+ {
+ if(!contains(element))
+ {
+ T[] identicalArray = Arrays.copyOf(inputArray, inputArray.length);
+ inputArray = identicalArray;
+ }
+
+ else
+ {
+ T[] reducedArray = Arrays.copyOf(inputArray, inputArray.length - 1);
+
+ int indexToRemove = indexOf(element);
+
+ for (int i = indexToRemove; i < inputArray.length -1; i++)
+ {
+ reducedArray[i] = inputArray[i + 1];
+ }
+
+ inputArray = reducedArray;
+ }
+
+ }
+
+
+ public T[] toArray(T[] newArray)
+ {
+ return (T[]) Arrays.copyOf(inputArray, inputArray.length, newArray.getClass());
+ }
+
+ public T[] toArray()
+ {
+ T[] temp = (T[]) new Object[size()];
+
+ for (int i = 0; i < size(); i++)
+ {
+ temp[i] = get(i);
+ }
+
+ return inputArray = temp;
+ }
+
+ //isEmpty
+ public boolean isEmpty()
+ {
+ if (inputArray.length == 0)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+
+ //Display Array Contents
+ public void printArrayContents()
+ {
+ String arrayAsString = Arrays.toString(inputArray);
+ System.out.println(arrayAsString);
+
+ }
+
+
+
+}
diff --git a/src/main/java/MyMap.java b/src/main/java/MyMap.java
new file mode 100644
index 0000000..c947f3a
--- /dev/null
+++ b/src/main/java/MyMap.java
@@ -0,0 +1,100 @@
+
+
+public class MyMap
+{
+ private MyArrayList entries;
+
+ public MyMap()
+ {
+ this.entries = new MyArrayList<>();
+ }
+
+ public void put(K key, V value)
+ {
+ for (int i = 0; i < entries.size(); i++)
+ {
+ if(entries.get(i).equals(key))
+ {
+ entries.set(i, new Entry<>(key, value));
+ break;
+ }
+ }
+ entries.add(new Entry<>(key, value));
+ }
+
+ public Object get(Object key)
+ {
+ for (int i = 0; i < entries.size(); i++)
+ {
+ if(entries.get(i).getKey().equals(key))
+ {
+ return entries.get(i).getValue();
+ }
+ }
+
+ return null;
+ }
+
+ public void remove(Object key)
+ {
+ for (int i = 0; i < entries.size(); i++)
+ {
+ if (entries.get(i).getKey().equals(key))
+ {
+ entries.remove(entries.get(i));
+ }
+ }
+
+ }
+
+ public Integer size()
+ {
+ return entries.size();
+ }
+
+ public boolean containsKey(Object key)
+ {
+ for (int i = 0; i < entries.size(); i++)
+ {
+ if(entries.get(i).getKey().equals(key))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public boolean containsValue(Object value)
+ {
+ for (int i = 0; i < entries.size(); i++)
+ {
+ if(entries.get(i).getValue().equals(value))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ private class Entry
+ {
+ private K key;
+ private V value;
+
+ public Entry(K key, V value)
+ {
+ this.key = key;
+ this.value = value;
+ }
+
+ public K getKey() {
+ return key;
+ }
+
+ public V getValue(){
+ return value;
+ }
+ }
+}
diff --git a/src/main/java/MySet.java b/src/main/java/MySet.java
new file mode 100644
index 0000000..24cad43
--- /dev/null
+++ b/src/main/java/MySet.java
@@ -0,0 +1,86 @@
+import java.util.Arrays;
+
+public class MySet
+{
+ private MyArrayList mySetList;
+
+ //Constructors
+ public MySet()
+ {
+ this.mySetList = new MyArrayList();
+ }
+
+ public MySet(T[] elements)
+ {
+ mySetList = new MyArrayList<>();
+
+ for (T index : elements)
+ {
+ if(!contains(index))
+ {
+ mySetList.add(index);
+ }
+ }
+ }
+
+ //add
+ public void add(T element)
+ {
+ if(!contains(element))
+ {
+ mySetList.add(element);
+ }
+ }
+
+ //size
+ public Integer size()
+ {
+ return this.mySetList.size();
+ }
+
+ //get
+ public T get(int index)
+ {
+ return mySetList.get(index);
+ }
+
+ //set
+ public void set (T element, int index)
+ {
+ mySetList.set(index, element);
+ }
+
+ //clear
+ public void clear()
+ {
+ mySetList.clear();
+
+ }
+
+ //contains
+ public boolean contains(T element)
+ {
+ return mySetList.contains(element);
+ }
+
+ //remove
+ public void remove(T element)
+ {
+ mySetList.remove(element);
+ }
+
+ //isEmpty
+ public boolean isEmpty()
+ {
+ if(mySetList.size().equals(0))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+
+
+
+}
diff --git a/src/test/java/MyArrayListTest.java b/src/test/java/MyArrayListTest.java
new file mode 100644
index 0000000..198115b
--- /dev/null
+++ b/src/test/java/MyArrayListTest.java
@@ -0,0 +1,284 @@
+import org.junit.Assert;
+import org.junit.Test;
+
+
+public class MyArrayListTest
+{
+
+ @Test
+ public void addTest()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList();
+ Integer expected = 5;
+ myArrayList.add(expected);
+
+ //When
+ Integer actual = myArrayList.get(0);
+
+ //Then
+ Assert.assertEquals(expected, actual);
+
+ }
+
+ @Test
+ public void addAnyWhereTest()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(1);
+ myArrayList.add(2);
+ myArrayList.add(4);
+ myArrayList.add(5);
+ Integer expected = 3;
+ myArrayList.addAnywhere(3, 2);
+
+ //When
+ Integer actual = 3;
+
+ //Then
+ Assert.assertEquals(expected, actual);
+ myArrayList.printArrayContents();
+
+
+ }
+
+ @Test
+ public void getTest()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("I");
+ myArrayList.add("love");
+ myArrayList.add("myself");
+ String expected = "myself";
+
+ //When
+ String actual = myArrayList.get(2);
+
+ //Then
+ Assert.assertEquals(expected, actual);
+
+
+ }
+
+ @Test
+ public void setTest()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(1);
+ myArrayList.add(2);
+ myArrayList.add(4);
+ Integer expected = 3;
+ myArrayList.set(2, 3);
+
+ //When
+ Integer actual = myArrayList.get(2);
+
+ //Then
+ Assert.assertEquals(expected, actual);
+ myArrayList.printArrayContents();
+
+ }
+
+ @Test
+ public void clearTest()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+
+ myArrayList.add(1);
+ myArrayList.add(2);
+ myArrayList.add(3);
+
+ myArrayList.clear();
+
+ boolean expected = true;
+
+ //When
+ boolean actual = myArrayList.isEmpty();
+
+ //Then
+ Assert.assertEquals(expected, actual);
+ myArrayList.printArrayContents();
+
+
+ }
+
+
+ @Test
+ public void indexOfTest()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(3);
+ myArrayList.add(4);
+ myArrayList.add(2);
+ myArrayList.add(5);
+ Integer expected = 3;
+
+ //When
+ Integer actual = myArrayList.indexOf(5);
+
+ //Then
+ Assert.assertEquals(expected, actual);
+ myArrayList.printArrayContents();
+
+
+ }
+
+ @Test
+ public void containsTest1()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("I");
+ myArrayList.add("love");
+ myArrayList.add("Myself");
+ boolean expected = true;
+
+ //When
+ boolean actual = myArrayList.contains("love");
+
+ //Then
+ Assert.assertEquals(expected, actual);
+ myArrayList.printArrayContents();
+
+ }
+
+ @Test
+ public void containsTest2()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("I");
+ myArrayList.add("love");
+ myArrayList.add("Myself");
+ boolean expected = false;
+
+ //When
+ boolean actual = myArrayList.contains("you");
+
+ //Then
+ Assert.assertEquals(expected, actual);
+ myArrayList.printArrayContents();
+
+ }
+
+
+ @Test
+ public void removeTest1()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("I");
+ myArrayList.add("love");
+ myArrayList.add("myself");
+ myArrayList.add("too");
+
+
+ myArrayList.remove("I");
+
+ String [] expected = {"love", "myself", "too"};
+
+ //When
+ String [] actual = myArrayList.toArray(new String[0]);
+
+ //Then
+ Assert.assertArrayEquals(expected, actual);
+ myArrayList.printArrayContents();
+ }
+
+ @Test
+ public void removeTest2()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(1);
+ myArrayList.add(2);
+ myArrayList.add(3);
+ myArrayList.add(4);
+
+ myArrayList.remove(1);
+
+ Integer [] expected = {2, 3, 4};
+
+ //When
+ Integer [] actual = myArrayList.toArray(new Integer[0]);
+
+ Assert.assertArrayEquals(expected, actual);
+ myArrayList.printArrayContents();
+ }
+
+ @Test
+ public void toArrayTest1()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(1);
+ myArrayList.add(2);
+ myArrayList.add(3);
+ myArrayList.add(4);
+
+ Integer [] expected = {1, 2, 3, 4};
+
+ //When
+ Integer [] actual = myArrayList.toArray(new Integer[0]);
+
+ //Then
+ Assert.assertArrayEquals(expected, actual);
+ myArrayList.printArrayContents();
+
+ }
+
+ @Test
+ public void toArrayTest2()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("I");
+ myArrayList.add("like");
+ myArrayList.add("pizza");
+
+ String [] expected = {"I", "like", "pizza"};
+
+ //When
+ Object [] actual = myArrayList.toArray();
+
+ //Then
+ Assert.assertArrayEquals(expected, actual);
+ myArrayList.printArrayContents();
+ }
+
+
+
+
+
+
+
+
+ @Test
+ public void isEmptyTest()
+ {
+ //Given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("I");
+ myArrayList.add("love");
+ myArrayList.add("myself");
+ boolean expected = false;
+
+ //When
+ boolean actual = myArrayList.isEmpty();
+
+ //Then
+ Assert.assertEquals(expected, actual);
+ myArrayList.printArrayContents();
+
+
+ }
+
+
+
+
+}
diff --git a/src/test/java/MyMapTest.java b/src/test/java/MyMapTest.java
new file mode 100644
index 0000000..5aa522b
--- /dev/null
+++ b/src/test/java/MyMapTest.java
@@ -0,0 +1,121 @@
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class MyMapTest {
+
+ @Test
+ public void putTest()
+ {
+ //Given
+ MyMap stringIntegerMyMap = new MyMap<>();
+ stringIntegerMyMap.put("Ahson", 1);
+ stringIntegerMyMap.put("Leon", 2);
+ Object expectedValue = 2;
+
+ //When
+ Object actualValue = stringIntegerMyMap.get("Leon");
+
+ //Then
+ Assert.assertEquals(expectedValue, actualValue);
+
+ }
+
+ @Test
+ public void getTest()
+ {
+ //Given
+ MyMap integerStringMyMap = new MyMap<>();
+ integerStringMyMap.put(1, "Ahson");
+ integerStringMyMap.put(2, "Leon");
+ Object expectedValue = "Ahson";
+
+ //When
+ Object actualValue = integerStringMyMap.get(1);
+
+ //Then
+ Assert.assertEquals(expectedValue, actualValue);
+ }
+
+ @Test
+ public void removeTest()
+ {
+ //Given
+ MyMap integerStringMyMap = new MyMap<>();
+ integerStringMyMap.put(1, "Ahson");
+ integerStringMyMap.put(2, "Leon");
+ integerStringMyMap.remove(2);
+
+ Assert.assertFalse(integerStringMyMap.containsKey(2));
+ }
+
+ @Test
+ public void sizeTest()
+ {
+ //Given
+ MyMap integerStringMyMap = new MyMap<>();
+ integerStringMyMap.put(1, "Ahson");
+ integerStringMyMap.put(2, "Leon");
+
+ Integer expected = 2;
+
+ //When
+ Integer actual = integerStringMyMap.size();
+
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void containsKeyTest1()
+ {
+
+ MyMap integerStringMyMap = new MyMap<>();
+ integerStringMyMap.put(1, "Ahson");
+ integerStringMyMap.put(2, "Leon");
+
+
+ Assert.assertTrue(integerStringMyMap.containsKey(1));
+
+ }
+
+ @Test
+ public void containsKeyTest2()
+ {
+
+ MyMap integerStringMyMap = new MyMap<>();
+ integerStringMyMap.put(1, "Ahson");
+ integerStringMyMap.put(2, "Leon");
+
+
+ Assert.assertFalse(integerStringMyMap.containsKey(3));
+
+ }
+
+ @Test
+ public void containsValueTest1()
+ {
+ MyMap integerStringMyMap = new MyMap<>();
+ integerStringMyMap.put(1, "Ahson");
+ integerStringMyMap.put(2, "Leon");
+
+
+ Assert.assertTrue(integerStringMyMap.containsValue("Ahson"));
+
+ }
+
+ @Test
+ public void containsValueTest2()
+ {
+ MyMap integerStringMyMap = new MyMap<>();
+ integerStringMyMap.put(1, "Ahson");
+ integerStringMyMap.put(2, "Leon");
+
+
+ Assert.assertFalse(integerStringMyMap.containsValue("Joe"));
+
+ }
+
+
+}
\ 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..a62cf0a
--- /dev/null
+++ b/src/test/java/MySetTest.java
@@ -0,0 +1,166 @@
+import org.junit.Assert;
+import org.junit.Test;
+
+public class MySetTest {
+ @Test
+ public void add()
+ {
+ //Given
+ MySet stringMySet = new MySet<>();
+ stringMySet.add("I");
+ stringMySet.add("love");
+ stringMySet.add("code");
+
+ Integer expected = 3;
+
+ //When
+ Integer actual = stringMySet.size();
+
+ //Then
+ Assert.assertEquals(expected, actual);
+
+
+ }
+
+ @Test
+ public void getTest()
+ {
+ //Given
+ MySet stringMySet = new MySet<>();
+ stringMySet.add("I");
+ stringMySet.add("love");
+ stringMySet.add("you");
+
+ String expected = "love";
+
+ //When
+ String actual = stringMySet.get(1);
+
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void setTest()
+ {
+ //Given
+ MySet stringMySet = new MySet<>();
+ stringMySet.add("I");
+ stringMySet.add("hate");
+ stringMySet.add("vegetables");
+
+ String expected = "love";
+ stringMySet.set("love", 1);
+
+ //When
+ String actual = stringMySet.get(1);
+
+ //Then
+ Assert.assertEquals(expected, actual);
+
+
+
+ }
+
+ @Test
+ public void clear()
+ {
+ //Given
+ MySet stringMySet = new MySet<>();
+ stringMySet.add("I");
+ stringMySet.add("love");
+ stringMySet.add("myself");
+
+ stringMySet.clear();
+
+ Integer expected = 0;
+
+ //When
+ Integer actual = stringMySet.size();
+
+ //Then
+ Assert.assertEquals(expected, actual);
+
+
+
+ }
+
+ @Test
+ public void containsTest1()
+ {
+ //Given
+ MySet integerMySet = new MySet<>();
+ integerMySet.add(1);
+ integerMySet.add(2);
+ integerMySet.add(3);
+
+ //When
+ integerMySet.contains(3);
+
+ //Then
+ Assert.assertTrue(integerMySet.contains(3));
+ }
+
+ @Test
+ public void containsTest2()
+ {
+ //Given
+ MySet stringMySet = new MySet<>();
+
+ stringMySet.add("I");
+ stringMySet.add("love");
+ stringMySet.add("you");
+
+ //When
+ stringMySet.contains("hate");
+
+ //Then
+ Assert.assertFalse(stringMySet.contains("hate"));
+ }
+
+
+
+ @Test
+ public void removeTest()
+ {
+ //Given
+ MySet stringMySet = new MySet<>();
+ stringMySet.add("Chocolate");
+ stringMySet.add("Chocolate");
+ stringMySet.add("Vanilla");
+ stringMySet.add("Strawberry");
+ stringMySet.add("Pecan");
+ stringMySet.add("Chocolate");
+
+ stringMySet.remove("Chocolate");
+
+ Integer expected = 3;
+
+ //When
+ Integer actual = stringMySet.size();
+
+ //Then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void isEmptyTest()
+ {
+ //Given
+ MySet stringMySet = new MySet<>();
+ stringMySet.add("I");
+ stringMySet.add("love");
+ stringMySet.add("myself");
+
+ //When
+ stringMySet.clear();
+
+ //Then
+ Assert.assertTrue(stringMySet.isEmpty());
+
+ }
+
+
+
+
+}