Code example for ConcurrentMap

Methods: keySet

0
     
    /** Get all events 
     * @return an Set of all events 
     */ 
    public Set<String> keys () {
	return counters.keySet ();
    } 
 
    /** Get the current count for an event. 
     * @param key the event were intrested in 
     * @return the current count of event. 
     */ 
    public int get (String key) {
	AtomicInteger l = counters.get (key);
	if (l == null)
	    return 0; 
	return l.get ();
    } 
}