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..9203de1
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,762 @@
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 6f607c0..2c6f52a 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ Implement your own version of an ArrayList (we'll call it MyArrayList), with the
- MyArrayList must be a generic type, which can store any other type of object
- MyArrayList must not use List, ArrayList or any other collection type in its implementation, only Arrays (The purpose of this is to practice designing your own generic class from the ground up, so that you can appreciate their complexities and usefulness)
- MyArrayList must have `add()`, `get()`, `remove()`, `set()`, `clear()`, `isEmpty()`, `contains()` and other methods to provide the same basic functionality described in the [ArrayList documentation](https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html)
-- `add()` should be overridden to add an element to the end of the Array, or to add the element to a specified index in the array.
+- `add()` should be overridden to add an element to the end of the Array, or to add the element to a specified myLength in the array.
- MyArrayList must have a no-argument constructor (`MyArrayList()`) to initialize a new instance, it should also have a one-argument constructor (`MyArrayList(int)`) that takes an int and starts the list off at the specified size.
- MyArrayList should automatically resize and maintain its order.
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..b7e1dfc
--- /dev/null
+++ b/src/main/java/MyArrayList.java
@@ -0,0 +1,115 @@
+import java.util.Arrays;
+
+public class MyArrayList {
+ //NO use of List, ArrayList, or any Collection, use ONLY Arrays
+ private E[] myArrayList;
+ private Integer size = 0;
+ private final Integer DEFAULTINCREMENTOR = 10;
+
+ //Create a empty list with size of the parameter
+ public MyArrayList (int length){
+ myArrayList = (E[]) new Object[length];
+ }
+
+ public MyArrayList() {
+ myArrayList = (E[]) new Object[this.DEFAULTINCREMENTOR];
+ }
+
+ public Integer size() {
+ return this.size;
+ }
+
+
+ public void add(E element){
+ if (size() < myArrayList.length){
+ myArrayList[size()]=element;
+ }
+ else if(size() == myArrayList.length){
+ E[] newArray = Arrays.copyOf(myArrayList, myArrayList.length+this.DEFAULTINCREMENTOR );
+ newArray[size()+1]=element;
+ myArrayList = newArray;
+ }
+ this.size++;
+ }
+
+ public void add(int index, E element){
+ if (size() < myArrayList.length){
+ for(int i = index - 1; i > 0; i--) {
+ myArrayList[i] = myArrayList[i - 1];
+ }
+ myArrayList[index]=element;
+ }
+ else if(size() == myArrayList.length){
+ E[] newArray = Arrays.copyOf(myArrayList, myArrayList.length+this.DEFAULTINCREMENTOR );
+ for(int i = index - 1; i > 0; i--) {
+ myArrayList[i] = myArrayList[i - 1];
+ }
+ newArray[index]=element;
+ myArrayList = newArray;
+ }
+ this.size++;
+ }
+
+ public E get(Integer index) {
+ return myArrayList[index];
+ }
+
+ public Integer indexOf (E object){
+ for (int i = 0; i < size(); i++) {
+ if(myArrayList[i].equals(object)){
+ return i;
+ }
+ }
+ return -1;
+ }
+ public void remove(int index) {
+ E[] newArray = Arrays.copyOf(myArrayList, myArrayList.length-1 );
+ myArrayList[index] = null;
+ int newArrIndex = 0;
+ for (int i = 0; i {
+
+ private MySet myMap;
+
+ private Integer size = 0;
+
+
+}
diff --git a/src/main/java/MySet.java b/src/main/java/MySet.java
new file mode 100644
index 0000000..bf6fefb
--- /dev/null
+++ b/src/main/java/MySet.java
@@ -0,0 +1,58 @@
+import java.util.Arrays;
+
+public class MySet {
+
+ //
+ private MyArrayList mySet;
+ private Integer size = 0;
+
+ //Create a empty list with size of the parameter
+ public MySet (int length){
+ mySet = new MyArrayList<>(length);
+ }
+
+ public MySet() {
+ mySet = new MyArrayList<>();
+ }
+
+ public Integer size() {
+ return this.size;
+ }
+
+
+ public void add(E element){
+ if(!mySet.contains(element)){
+ mySet.add(element);
+ size++;
+ }
+ }
+
+ public E get(Integer index) {
+ return mySet.get(index);
+ }
+
+ public Integer indexOf (E object){
+ return mySet.indexOf(object);
+ }
+ public void remove(int index) {
+ mySet.remove(index);
+
+ }
+
+ public void set(int index, E element){
+ mySet.set(index, element);
+ }
+ public void clear() {
+ mySet.clear();
+ size = 0;
+ }
+
+ public boolean isEmpty() {
+ return mySet.isEmpty();
+ }
+
+ public boolean contains (E object){
+ return mySet.contains(object);
+
+ }
+}
diff --git a/src/test/java/MyArrayListTest.java b/src/test/java/MyArrayListTest.java
new file mode 100644
index 0000000..80c56e6
--- /dev/null
+++ b/src/test/java/MyArrayListTest.java
@@ -0,0 +1,166 @@
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.ArrayList;
+
+public class MyArrayListTest {
+
+ @Test
+ public void addTest() {
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("hello");
+ myArrayList.add("world");
+
+ Integer expected = 2;
+ Integer actual = myArrayList.size();
+
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void addByIndexTest() {
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("hello");
+ myArrayList.add("world");
+ myArrayList.add("my");
+ myArrayList.add("name");
+ myArrayList.add("is");
+ myArrayList.add("bo");
+ myArrayList.add(0, "hey");
+
+ String expected = "hey";
+ String actual = myArrayList.get(0);
+ System.out.println(myArrayList.printOut());;
+ Assert.assertEquals(expected, actual);
+ }
+
+
+ @Test
+ public void getTest() {
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(333);
+ myArrayList.add(222);
+
+ Integer expected = 222;
+ Integer actual = myArrayList.get(1);
+
+ Assert.assertEquals(expected, actual);
+
+ }
+
+ @Test
+ public void removeTest() {
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(333.1);
+ myArrayList.add(222.99);
+ myArrayList.add(21.34);
+ myArrayList.remove(1);
+
+ Double expected = 21.34;
+ Double actual = myArrayList.get(1);
+
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void setTest() {
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(333.1);
+ myArrayList.add(222.99);
+ myArrayList.add(21.34);
+ myArrayList.set(1, 99.8);
+
+ Double expected = 99.8;
+ Double actual = myArrayList.get(1);
+
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void clearTest() {
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(333.1);
+ myArrayList.add(222.99);
+ myArrayList.add(21.34);
+
+ myArrayList.clear();
+
+ int expected = 0;
+ int actual = myArrayList.size();
+
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void isEmptyTest() {
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(333.1);
+ myArrayList.add(222.99);
+ myArrayList.add(21.34);
+ myArrayList.remove(1);
+
+ boolean expected = false;
+ boolean actual = myArrayList.isEmpty();
+
+ Assert.assertEquals(expected, actual);
+
+
+ }
+
+ @Test
+ public void sizeTest() {
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("hello");
+ myArrayList.add("world");
+ myArrayList.add("welcome");
+ myArrayList.add("home");
+
+ Integer expected = 4;
+ Integer actual = myArrayList.size();
+
+ Assert.assertEquals(expected, actual);
+ }
+
+
+ @Test
+ public void containsTest() {
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(333.1);
+ myArrayList.add(222.99);
+ myArrayList.add(21.34);
+ myArrayList.remove(1);
+
+ boolean expected = false;
+ boolean actual = myArrayList.contains(21.22);
+
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void indexOfTest() {
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add(333.1);
+ myArrayList.add(222.99);
+ myArrayList.add(21.34);
+
+ Integer expected = 2;
+ Integer actual = myArrayList.indexOf(21.34);
+
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void printOut(){
+ MyArrayList myArrayList = new MyArrayList<>();
+ myArrayList.add("hello");
+ myArrayList.add("world");
+ myArrayList.add("my");
+ myArrayList.add("name");
+ myArrayList.add("is");
+ myArrayList.add("bo");
+
+ String expected = "hello world my name is bo ";
+ String actual = myArrayList.printOut();
+ 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..7e16c1f
--- /dev/null
+++ b/src/test/java/MySetTest.java
@@ -0,0 +1,153 @@
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class MySetTest {
+
+ @Test
+ public void size() {
+ MySet mySet = new MySet<>();
+
+ Integer expected = 0;
+ Integer actual = mySet.size();
+
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void add() {
+ MySet mySet = new MySet<>();
+ mySet.add(111);
+ mySet.add(222);
+ mySet.add(333);
+
+ Integer expected = 3;
+ Integer actual = mySet.size();
+
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void addDuplicate(){
+ MySet mySet = new MySet<>();
+ mySet.add(111);
+ mySet.add(222);
+ mySet.add(333);
+
+// boolean expected1 = false;
+// boolean actual1 = mySet.add(222);
+//
+// Assert.assertEquals(expected1, actual1);
+ }
+
+ @Test
+ public void get() {
+ MySet mySet = new MySet<>();
+ mySet.add(111);
+ mySet.add(222);
+ mySet.add(333);
+
+ Integer expected = 222;
+ Integer actual = mySet.get(1);
+
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void indexOf() {
+ MySet mySet = new MySet<>();
+ mySet.add("hello");
+ mySet.add("my");
+ mySet.add("name");
+ mySet.add("is");
+ mySet.add("bob");
+
+ Integer expected = 2;
+ Integer actual = mySet.indexOf("name");
+
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void remove() {
+ MySet mySet = new MySet<>();
+ mySet.add("hello");
+ mySet.add("my");
+ mySet.add("name");
+ mySet.add("is");
+ mySet.add("bob");
+
+ mySet.remove(1);
+
+ Integer expected = 5;
+ Integer actual = mySet.size();
+
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void set() {
+ MySet mySet = new MySet<>();
+ mySet.add("hello");
+ mySet.add("my");
+ mySet.add("name");
+ mySet.add("is");
+ mySet.add("bob");
+
+ mySet.set(1, "name");
+
+ String expected = "name";
+ String actual = mySet.get(1);
+
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void clear() {
+ MySet mySet = new MySet<>();
+ mySet.add("hello");
+ mySet.add("my");
+ mySet.add("name");
+ mySet.add("is");
+ mySet.add("bob");
+
+ mySet.clear();
+
+ int expected = 0;
+ int actual = mySet.size();
+
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void isEmpty() {
+ MySet mySet = new MySet<>();
+ mySet.add("hello");
+ mySet.add("my");
+ mySet.add("name");
+ mySet.add("is");
+ mySet.add("bob");
+
+ boolean expected = false;
+ boolean actual = mySet.isEmpty();
+
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void contains() {
+
+ MySet mySet = new MySet<>();
+ mySet.add("hello");
+ mySet.add("my");
+ mySet.add("name");
+ mySet.add("is");
+ mySet.add("bob");
+
+ boolean expected = true;
+ boolean actual = mySet.contains("bob");
+
+ Assert.assertEquals(expected,actual);
+ }
+}
\ No newline at end of file