|
@@ -1,5 +1,10 @@
|
1
|
1
|
package com.zipcodewilmington.arrayutility;
|
2
|
2
|
|
|
3
|
+import java.lang.reflect.Array;
|
|
4
|
+import java.util.ArrayList;
|
|
5
|
+import java.util.Arrays;
|
|
6
|
+import java.util.List;
|
|
7
|
+
|
3
|
8
|
/**
|
4
|
9
|
* Created by leon on 3/6/18.
|
5
|
10
|
*/
|
|
@@ -55,9 +60,14 @@ public class ArrayUtility <T> {
|
55
|
60
|
return count;
|
56
|
61
|
|
57
|
62
|
}
|
58
|
|
-
|
59
|
63
|
public T[] removeValue(T valueToRemove) {
|
60
|
|
- return null;
|
|
64
|
+ List<T> list = new ArrayList<>();
|
|
65
|
+ for(T element : inputArray){
|
|
66
|
+ if (!element.equals(valueToRemove)){
|
|
67
|
+ list.add(element);
|
|
68
|
+ }
|
|
69
|
+ }
|
|
70
|
+ return list.toArray((T[])Array.newInstance(inputArray.getClass().getComponentType(),list.size()));
|
61
|
71
|
|
62
|
72
|
}
|
63
|
73
|
public T[] merge(T[] inputArray, T[] arrayToMerge){
|