Q:

How to count frequency of an enum in an ArrayList of object

As an example to my question... Say I have an ArrayList containing Car objects.  A Car object is comprised of a Model and Colour Enum.  I want to count how many car models of type Audi are in the list, Audi is an ENUM
I have an int variable called int Audi 
And I'm trying Audi=Collections.frequency(list, Model. AUDI);
However it is not counting the frequency and Audi=0
Where am I going wrong and how can I count the frequency of an enum?  

A:

Your use of Collections.frequency is incorrect; you are looking in a list of Cars for a Model enum, so it's no surprise that the count is 0. 
If you're using Java 8, you can set up a Stream so that you can filter the contents and then count the remaining elements.   This assumes that Car has a getModel getter method. 
long audi = list.stream().filter( c -> c.getModel() == Model. AUDI ).count();

A:

Collections.frequency only works if the array is containing objects of the same Type as the object passed.   In this case, you have an array of type <Car> and are checking for an object of type Model (an instance of Car will never equal an enum Model). 
You will need to write your own loop to go through and perform the count (it should be easy).