private void rescale(int capacityIndex) {

        Array<Array<KeyValueHolder<K, V>>> oldBuckets = buckets;

        // Change the hash capacity
        buckets = new Array<Array<KeyValueHolder<K, V>>>(primes[capacityIndex]);

        KeyValueHolder<K, V> holder;

        // See the old buckets
        for (int i = 0; i < oldBuckets.getSize(); ++i) {

            // See the collisions
            Array<KeyValueHolder<K, V>> subArray = oldBuckets.getElement(i);

            if (subArray != null) {
                for (int j = 0; j < subArray.getSize(); ++j) {
                    holder = subArray.getElement(j);
                    put(holder.key, holder.value);
                }
            }
        }
    }