I have an ArrayList, a Collection class of Java, as follows:
ArrayList
ArrayList animals = new ArrayList(); animals.add(\"bat\
I'm pretty sure the static frequency-method in Collections would come in handy here:
int occurrences = Collections.frequency(animals, "bat");
That's how I'd do it anyway. I'm pretty sure this is jdk 1.6 straight up.