Browse Source

Number of Occurrences test passed

Lauren Green 6 years ago
parent
commit
facfe2042b

+ 9
- 1
src/main/java/com/zipcodewilmington/arrayutility/ArrayUtility.java View File

@@ -26,7 +26,15 @@ public class ArrayUtility<T> {
26 26
 
27 27
     public Integer getNumberOfOccurrences(T valueToEvaluate) {
28 28
 
29
-        return null;
29
+        Integer count = 0;
30
+
31
+        for (T data: array) {
32
+            if (data.equals(valueToEvaluate)) {
33
+                count++;
34
+            }
35
+        }
36
+
37
+        return count;
30 38
     }
31 39
 
32 40
     public T[] removeValue(T valueToRemove) {