Class DynamicLinearProbeNonNegativeIntCounter
java.lang.Object
ai.timefold.solver.core.impl.util.DynamicLinearProbeNonNegativeIntCounter
A class representing a non-negative int-to-int map that is compacted so the backing int
arrays are as small as possible.
IMPORTANT: As the class does a linear probe, it is only appropriate to use
when counting up to a few dozen keys. When using more keys, use a
Map instead.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecrement(int key) Decrement the count of key, deleting the entry for it if count is 0.intgetCount(int key) Get the count of key, or 0 if it not present in the counter.voidincrement(int key) Increment the count of key, creating an entry for it if none is present.toString()
-
Constructor Details
-
DynamicLinearProbeNonNegativeIntCounter
public DynamicLinearProbeNonNegativeIntCounter()
-
-
Method Details
-
getCount
public int getCount(int key) Get the count of key, or 0 if it not present in the counter. -
increment
public void increment(int key) Increment the count of key, creating an entry for it if none is present. -
decrement
public void decrement(int key) Decrement the count of key, deleting the entry for it if count is 0. -
toString
-