Java tutorial
import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { public static void main(String args[]) { // create array list object List<String> arrlist = new ArrayList<String>(); // populate the list arrlist.add("A"); arrlist.add("B"); arrlist.add("B"); arrlist.add("B"); arrlist.add("B"); arrlist.add("from java2s.com"); // check frequensy of 'B' int freq = Collections.frequency(arrlist, "B"); System.out.println("Frequency of 'B' is: " + freq); } }