Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Map; public class Main { private static final <T> int getFreq(final T obj, final Map<T, Integer> freqMap) { Integer count = freqMap.get(obj); if (count != null) { return count.intValue(); } return 0; } }