CounterMap implements Iterable<Map.Entry<K, Long>> { public long addAndGet(K key, long delta) { long retVal; removalLock.readLock().lock(); try { retVal = getCounter(key).addAndGet(delta); } finally { removalLock.readLock().unlock(); } if (retVal == 0) { tryCleanup(key); } return retVal; }  long addAndGet(K key, long delta); long size(); long getAndAdd(K key, long delta); AtomicLong remove(K key); long get(K key); long tryInitializeCounter(K key, long value); long trySetCounter(K key, long value); void clear(); @Override Iterator<Map.Entry<K, Long>> iterator();  }
@Test public void testAddAndGet() throws Exception { Assert.assertEquals(counterMap.addAndGet("fuu", 1), 1); }