I have an ArrayList, a Collection class of Java, as follows:
ArrayList
ArrayList animals = new ArrayList(); animals.add(\"bat\
So do it the old fashioned way and roll your own:
Map instances = new HashMap(); void add(String name) { Integer value = instances.get(name); if (value == null) { value = new Integer(0); instances.put(name, value); } instances.put(name, value++); }