浏览代码

arrAnalyz 11 - 11

tictactoe 21 - 21
waveGener 10 - 10
collectio 0
pigLatin  09 - 12
Generics  06 - 18
Total     53 - 108
Nick Satinover 6 年前
父节点
当前提交
d7c3185a56
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9
    1
      src/main/java/rocks/zipcode/io/quiz3/generics/ArrayUtility.java

+ 9
- 1
src/main/java/rocks/zipcode/io/quiz3/generics/ArrayUtility.java 查看文件

@@ -21,7 +21,15 @@ public class ArrayUtility<SomeType> {
21 21
     }
22 22
 
23 23
     public Integer getNumberOfOccurrences(SomeType valueToEvaluate) {
24
-        return null;
24
+        int count = 0;
25
+
26
+        for (SomeType s: array) {
27
+            if (s == valueToEvaluate){
28
+                count++;
29
+            }
30
+        }
31
+
32
+        return count;
25 33
     }
26 34
 
27 35
     public SomeType[] filter(Function<SomeType, Boolean> predicate) {