Java tutorial
//package com.java2s; //License from project: Apache License import java.util.HashMap; public class Main { public static void incrementHashMap(HashMap map, String key, int n) { int count; Integer countI = (Integer) map.get(key); if (countI == null) count = 0; else { count = countI; } map.put(key, count + n); } }