瀏覽代碼

Number of Occurrences test passed

Lauren Green 6 年之前
父節點
當前提交
facfe2042b
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9
    1
      src/main/java/com/zipcodewilmington/arrayutility/ArrayUtility.java

+ 9
- 1
src/main/java/com/zipcodewilmington/arrayutility/ArrayUtility.java 查看文件

@@ -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) {