Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Map; public class Main { public static <K> void increaseCount(Map<K, Integer> map, K key, int amount) { if (!map.containsKey(key)) { map.put(key, 0); } Integer total = map.get(key); total += amount; map.put(key, total); } }