|
@@ -15,9 +15,16 @@ public class ArrayUtility<T> {
|
15
|
15
|
}
|
16
|
16
|
|
17
|
17
|
public T getMostCommonFromMerge(T[] arrayToMerge) {
|
18
|
|
- Arrays.sort(mergeArrays(arrayToMerge));
|
19
|
|
- for( )
|
20
|
|
- return null;
|
|
18
|
+ mergeArrays(arrayToMerge);
|
|
19
|
+ Integer indexCount = 0;
|
|
20
|
+ T currentMatch = null;
|
|
21
|
+ for( T elementInArray : mergedArray){
|
|
22
|
+ if (getNumberOfOccurrences(elementInArray) > getNumberOfOccurrences(mergedArray[indexCount +1])){
|
|
23
|
+ currentMatch = elementInArray;
|
|
24
|
+ indexCount++;
|
|
25
|
+ }
|
|
26
|
+ }
|
|
27
|
+ return currentMatch;
|
21
|
28
|
}
|
22
|
29
|
|
23
|
30
|
public Integer countDuplicatesInMerge(T[] arrayToMerge, T valueToEvaluate) {
|