package com.tutorial4u;
import java.util.HashMap;
/************************************************************
No of Occurrence in Array
************************************************************/
public class NoOfOccurrenceInArray {
public static void
main(String[] args) {
int [] numbers = new int[] {10,12,13,14,12,11,10,20,21,14,22};
int count =0;
HashMap<Integer, Integer> map = new
HashMap<>();
for(Integer i : numbers) {
if(map.containsKey(i)) {
count = map.get(i);
map.put(i, count+1);
}else {
map.put(i, 1);
}
}
System.out.println(map);
}
}