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..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..6a8266f
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,570 @@
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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..dbfa8fc
--- /dev/null
+++ b/src/main/java/MyArrayList.java
@@ -0,0 +1,71 @@
+import java.util.Arrays;
+
+public class MyArrayList {
+
+ private T[] arr;
+ private T value;
+
+
+ //Constructors
+ public MyArrayList() {
+ arr = (T[]) new Object[0];
+ }
+
+ public MyArrayList(int arrSize){
+ arr = (T[]) new Object[arrSize];
+ }
+
+
+ //Methods
+ public void add(T thing) {
+
+ T[] newArr = Arrays.copyOf(arr, arr.length + 1);
+ newArr[newArr.length-1] = thing;
+ arr = newArr;
+ }
+
+
+ public T get(Integer i){
+ this.value = this.arr[i];
+ return this.value;
+ }
+
+ public void remove(T thing) {
+ if ( arr.length > 0){
+ T[] newArr = Arrays.copyOf(arr, arr.length - 1);
+ for (int i = 0, j = 0; i < arr.length; i++) {
+ if (arr[i] != thing) {
+ newArr[j] = arr[i];
+ j++;
+ }
+ }
+ arr = newArr;
+ }
+ }
+ public void set(Integer i, T thing){
+ this.value = this.arr[i];
+ arr[i] = thing;
+
+ }
+
+ public void clear(){
+ this.arr = (T[]) new Object[0];
+ }
+
+ public boolean isEmpty(){
+ if (arr.length == 0)
+ return true;
+ else return false;
+ }
+
+ public boolean contains(T valueToCheck){
+ for (int i = 0; i < arr.length; i++){
+ if (arr[i] == valueToCheck){
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+}
diff --git a/src/main/java/MySet.java b/src/main/java/MySet.java
new file mode 100644
index 0000000..155ca4c
--- /dev/null
+++ b/src/main/java/MySet.java
@@ -0,0 +1,92 @@
+import java.util.Arrays;
+
+public class MySet {
+ private E[] set;
+ private E value;
+
+ //Constructors
+ public MySet() {
+ set = (E[]) new Object[0];
+ }
+
+ public MySet(int setSize){
+ set = (E[]) new Object[setSize];
+ }
+
+ //Methods
+ public void add(E thing) {
+ int count = 0;
+ for (int i = 0; i < set.length; i++) {
+ if (set[i] == thing) {
+ count++;
+ }
+ }
+ if (count == 0) {
+ E[] newSet = Arrays.copyOf(set, set.length + 1);
+ newSet[newSet.length - 1] = thing;
+ set = newSet;
+ }
+ else System.out.println("This value already exists in the Set");
+ }
+
+
+ public E get(Integer i){
+ this.value = this.set[i];
+ return this.value;
+ }
+
+ public void remove(E thing) {
+ if ( set.length > 0){
+ E[] newSet = Arrays.copyOf(set, set.length - 1);
+ for (int i = 0, j = 0; i < set.length; i++) {
+ if (set[i] != thing) {
+ newSet[j] = set[i];
+ j++;
+ }
+ }
+ set = newSet;
+ }
+ }
+ public void set(Integer i, E thing){
+ this.value = this.set[i];
+ set[i] = thing;
+
+ }
+
+ public void clear(){
+ this.set = (E[]) new Object[0];
+ }
+
+ public boolean isEmpty(){
+ if (set.length == 0)
+ return true;
+ else return false;
+ }
+
+ public boolean contains(E valueToCheck){
+ for (int i = 0; i < set.length; i++){
+ if (set[i] == valueToCheck){
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/java/TestMyArrayList.java b/src/test/java/TestMyArrayList.java
new file mode 100644
index 0000000..9e12750
--- /dev/null
+++ b/src/test/java/TestMyArrayList.java
@@ -0,0 +1,202 @@
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestMyArrayList {
+
+ @Test
+ public void intAddTest(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ Integer expected = 5;
+ //when
+ myArrayList.add(expected);
+ //then
+ Integer actual = myArrayList.get(0);
+ Assert.assertEquals(expected, actual);
+ }
+
+
+ @Test
+ public void strAddTest(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ String expected = "Cat";
+ //when
+ myArrayList.add(expected);
+ //then
+ String actual = myArrayList.get(0);
+ Assert.assertEquals(expected, actual);
+
+ }
+
+ @Test
+ public void doubleAddTest(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ Double expected = 1234.000;
+ //when
+ myArrayList.add(expected);
+ //then
+ Double actual = myArrayList.get(0);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void intGetTest(){
+ //given
+ Integer expected = 7;
+ MyArrayListmyArrayList = new MyArrayList<>();
+ myArrayList.add(10);
+ myArrayList.add(9);
+ myArrayList.add(8);
+ myArrayList.add(expected);
+ myArrayList.add(6);
+ //when
+ Integer actual = myArrayList.get(3);
+ //then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void strGetTest(){
+ //given
+ String expected = "Cat";
+ MyArrayListmyArrayList = new MyArrayList<>();
+ myArrayList.add("Horse");
+ myArrayList.add("Duck");
+ myArrayList.add("Dog");
+ myArrayList.add(expected);
+ myArrayList.add("Bunny");
+ //when
+ String actual = myArrayList.get(3);
+ //then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void intRemoveTest(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(10);
+ myArrayList.add(9);
+ myArrayList.add(8);
+ myArrayList.add(5);
+ Integer expected = 5;
+ //when
+ myArrayList.remove(8);
+ //then
+ Integer actual = myArrayList.get(2);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void strRemoveTest(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("Cat");
+ myArrayList.add("Dog");
+ myArrayList.add("Duck");
+ myArrayList.add("Horse");
+ String expected = "Horse";
+ //when
+ myArrayList.remove("Duck");
+ //then
+ String actual = myArrayList.get(2);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void intSetTest(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(10);
+ myArrayList.add(9);
+ myArrayList.add(8);
+ myArrayList.add(5);
+ Integer expected = 25;
+ //when
+ myArrayList.set(2, expected);
+ //then
+ Integer actual = myArrayList.get(2);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void strSetTest(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("Cat");
+ myArrayList.add("Horse");
+ myArrayList.add("fdgkjhdfgkjhdgkjhf");
+ myArrayList.add("Dog");
+ String expected = "Duck";
+ //when
+ myArrayList.set(2, expected);
+ //then
+ String actual = myArrayList.get(2);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void clearTest(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("Cat");
+ myArrayList.add("Horse");
+ myArrayList.add("Bird");
+ myArrayList.add("Dog");
+
+ //when
+ myArrayList.clear();
+ boolean expected = true;
+ //then
+ boolean actual = myArrayList.isEmpty();
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void isEmptyTest(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ //when
+ myArrayList.isEmpty();
+ //then
+ Assert.assertTrue(myArrayList.isEmpty());
+ }
+
+ @Test
+ public void isEmptyTestTWO(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("Ducky");
+ //when
+ myArrayList.isEmpty();
+ //then
+ Assert.assertFalse(myArrayList.isEmpty());
+ }
+
+ @Test
+ public void containsTest(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("Ducky");
+ //when
+ myArrayList.contains("Dog");
+ //then
+ Assert.assertFalse(false);
+ }
+
+ @Test
+ public void containsTestTWO(){
+ //given
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("Ducky");
+ myArrayList.add("Dog");
+ //when
+ myArrayList.contains("Dog");
+ //then
+ Assert.assertTrue(true);
+ }
+
+
+}
diff --git a/src/test/java/TestMySet.java b/src/test/java/TestMySet.java
new file mode 100644
index 0000000..3089a8e
--- /dev/null
+++ b/src/test/java/TestMySet.java
@@ -0,0 +1,215 @@
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestMySet {
+
+ @Test
+ public void intAddTest(){
+ //given
+ MySet mySet = new MySet<>();
+ Integer expected = 5;
+ //when
+ mySet.add(expected);
+ //then
+ Integer actual = mySet.get(0);
+ Assert.assertEquals(expected, actual);
+ }
+
+
+ @Test
+ public void strAddTest(){
+ //given
+ MySet mySet = new MySet<>();
+ String expected = "Cat";
+ //when
+ mySet.add(expected);
+ //then
+ String actual = mySet.get(0);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void strAddTestTwo(){
+ //given
+ MySet mySet = new MySet<>();
+ mySet.add("Cat");
+ String expected = "Cat";
+ //when
+ mySet.add(expected);
+ //then
+ String actual = mySet.get(0);
+ Assert.assertEquals(expected, actual);
+ //Prints "This value already exists in the set"
+ }
+
+ @Test
+ public void doubleAddTest(){
+ //given
+ MySet mySet = new MySet<>();
+ Double expected = 1234.000;
+ //when
+ mySet.add(expected);
+ //then
+ Double actual = mySet.get(0);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void intGetTest(){
+ //given
+ Integer expected = 7;
+ MySetmySet = new MySet<>();
+ mySet.add(10);
+ mySet.add(9);
+ mySet.add(8);
+ mySet.add(expected);
+ mySet.add(6);
+ //when
+ Integer actual = mySet.get(3);
+ //then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void strGetTest(){
+ //given
+ String expected = "Cat";
+ MySetmySet = new MySet<>();
+ mySet.add("Horse");
+ mySet.add("Duck");
+ mySet.add("Dog");
+ mySet.add(expected);
+ mySet.add("Bunny");
+ //when
+ String actual = mySet.get(3);
+ //then
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void intRemoveTest(){
+ //given
+ MySet mySet = new MySet<>();
+ mySet.add(10);
+ mySet.add(9);
+ mySet.add(8);
+ mySet.add(5);
+ Integer expected = 5;
+ //when
+ mySet.remove(8);
+ //then
+ Integer actual = mySet.get(2);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void strRemoveTest(){
+ //given
+ MySet mySet = new MySet<>();
+ mySet.add("Cat");
+ mySet.add("Dog");
+ mySet.add("Duck");
+ mySet.add("Horse");
+ String expected = "Horse";
+ //when
+ mySet.remove("Duck");
+ //then
+ String actual = mySet.get(2);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void intSetTest(){
+ //given
+ MySet mySet = new MySet<>();
+ mySet.add(10);
+ mySet.add(9);
+ mySet.add(8);
+ mySet.add(5);
+ Integer expected = 25;
+ //when
+ mySet.set(2, expected);
+ //then
+ Integer actual = mySet.get(2);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void strSetterTest(){
+ //given
+ MySet mySet = new MySet<>();
+ mySet.add("Cat");
+ mySet.add("Horse");
+ mySet.add("fdgkjhdfgkjhdgkjhf");
+ mySet.add("Dog");
+ String expected = "Duck";
+ //when
+ mySet.set(2, expected);
+ //then
+ String actual = mySet.get(2);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void clearTest(){
+ //given
+ MySet mySet = new MySet<>();
+ mySet.add("Cat");
+ mySet.add("Horse");
+ mySet.add("Bird");
+ mySet.add("Dog");
+
+ //when
+ mySet.clear();
+ boolean expected = true;
+ //then
+ boolean actual = mySet.isEmpty();
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void isEmptyTest(){
+ //given
+ MySet mySet = new MySet<>();
+ //when
+ mySet.isEmpty();
+ //then
+ Assert.assertTrue(mySet.isEmpty());
+ }
+
+ @Test
+ public void isEmptyTestTWO(){
+ //given
+ MySet mySet = new MySet<>();
+ mySet.add("Ducky");
+ //when
+ mySet.isEmpty();
+ //then
+ Assert.assertFalse(mySet.isEmpty());
+ }
+
+ @Test
+ public void containsTest(){
+ //given
+ MySet mySet = new MySet<>();
+ mySet.add("Ducky");
+ //when
+ mySet.contains("Dog");
+ //then
+ Assert.assertFalse(false);
+ }
+
+ @Test
+ public void containsTestTWO(){
+ //given
+ MySet mySet = new MySet<>();
+ mySet.add("Ducky");
+ mySet.add("Dog");
+ //when
+ mySet.contains("Dog");
+ //then
+ Assert.assertTrue(true);
+ }
+
+
+}