K - type of objects being countedpublic class ObjectCounterUnsafe<K> extends Object
This class provides a lightweight alternative to ObjectCounter for single-threaded scenarios. It offers better performance with reduced object churn by using primitive integers instead of AtomicInteger.
Key differences from ObjectCounter:
Typical use cases include UI components and Sybil attack detection where thread safety is not required.
| Constructor and Description |
|---|
ObjectCounterUnsafe() |
public int add(K h, int val)
public void clear()
public void clear(K h)
public int count(K h)
public int increment(K h)