public class SimpleCapacityPolicy extends Object implements CapacityPolicy
CapacityPolicy.
The calculation looks like
int newCapcity = (currentCapacity * 3) / 2 + 1
and it's only apply if currentCapacity is not greater or equals than requiredCapacity.
| Constructor and Description |
|---|
SimpleCapacityPolicy() |
| Modifier and Type | Method and Description |
|---|---|
int |
ensureCapacity(int requiredCapacity,
int currentCapacity)
Ensuring the currentCapacity is save to accommodate new items that
totally defined as requiredCapacity.
|
public int ensureCapacity(int requiredCapacity,
int currentCapacity)
CapacityPolicyensureCapacity in interface CapacityPolicyrequiredCapacity - is the required capacity.currentCapacity - is the current capacity.