Here you can find the source of addOne(Map
Parameter | Description |
---|---|
map | the map. |
key | the key. |
K | the class of the key. |
private static <K> void addOne(Map<K, Long> map, K key)
//package com.java2s; //License from project: Open Source License import java.util.Map; public class Main { /**//from w w w. ja v a 2s . c o m * Increment a Map of K->Integer for a given key. * * @param map the map. * @param key the key. * @param <K> the class of the key. */ private static <K> void addOne(Map<K, Long> map, K key) { if (map != null) { if (map.get(key) != null) { map.put(key, map.get(key) + 1); } else { map.put(key, 1l); } } } }