Ensure minimal capacity for CoordMap (not relevant to known issues).

This commit is contained in:
asofold 2012-12-02 16:45:07 +01:00
parent 2c73a8adb8
commit 44b6eb2b2a

View File

@ -276,7 +276,7 @@ public class CoordMap<V> {
private final void resize(final int size) {
// TODO: other capacity / allow to set strategy [also for reducing for long time use]
final int newCapacity = Math.max((int) ((size + 4) / loadFactor), entries.length + entries.length / 4);
final int newCapacity = Math.min(Math.max((int) ((size + 4) / loadFactor), entries.length + entries.length / 4), 4);
@SuppressWarnings("unchecked")
final List<Entry<V>>[] newEntries = new List[newCapacity];
int used = -1; // Fill old buckets to fornt of old array.