Package net.i2p.util
Class ObjectCounterUnsafe<K>
java.lang.Object
net.i2p.util.ObjectCounterUnsafe<K>
Count things.
NOT thread safe, mostly for UI and Sybil.
Dropin replacement for ObjectCounter.
Much less object churn than ObjectCounter.
Also provides add() and sortedObjects()
- Since:
- 0.9.58
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
ObjectCounterUnsafe
public ObjectCounterUnsafe()
-
-
Method Details
-
increment
Add one.- Returns:
- count after increment
-
add
Add a value- Returns:
- count after adding
-
count
- Returns:
- current count
-
objects
- Returns:
- set of objects with counts > 0
-
sortedObjects
- Returns:
- list of objects reverse sorted by count, highest to lowest
-
clear
public void clear()Start over. Reset the count for all keys to zero. -
clear
Reset the count for this key to zero
-