write a script to count the number of occurrences of the given element in an array code example
Example: get ocurrences in array java
List asList = Arrays.asList(array);
Set<String> mySet = new HashSet<String>(asList);
for(String s: mySet){
System.out.println(s + " " +Collections.frequency(asList,s));
}