I cant get this to work properly it counts cumulative not per key I have tried multiple ways of resetting count++ i cant seem to figure it out This fixed it int count = 0; for (int i =0; i < intList.size(); i++){ if (map.containsKey(intList.get(i))){ map.put(intList.get(i), map.get(intList.get(i))+1); } }