net.i2p.util
Class ObjectCounter<K>

java.lang.Object
  extended by net.i2p.util.ObjectCounter<K>

public class ObjectCounter<K>
extends java.lang.Object

Count things.

Author:
zzz

Constructor Summary
ObjectCounter()
           
 
Method Summary
 int count(K h)
           
 void increment(K h)
          Add one.
 java.util.Set<K> objects()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectCounter

public ObjectCounter()
Method Detail

increment

public void increment(K h)
Add one. Not perfectly concurrent, new AtomicInteger(1) would be better, at the cost of some object churn.


count

public int count(K h)
Returns:
current count

objects

public java.util.Set<K> objects()
Returns:
set of objects with counts > 0