capacity = MathUtils.roundUpToPowerOfTwo(capacity); primaryTable = makeTable(capacity);
capacity = MathUtils.roundUpToPowerOfTwo(capacity); primaryTable = makeTable(capacity);
capacity = MathUtils.roundUpToPowerOfTwo(capacity); primaryTable = makeTable(capacity);
capacity = MathUtils.roundUpToPowerOfTwo(capacity); primaryTable = makeTable(capacity);
/** * Doubles the capacity of the hash table. Existing entries are placed in * the correct bucket on the enlarged table. If the current capacity is, * MAXIMUM_CAPACITY, this method is a no-op. Returns the table, which * will be new unless we were already at MAXIMUM_CAPACITY. */ private void doubleCapacity() { // There can only be one rehash in flight. From the amount of incremental rehash steps we take, this should always hold. Preconditions.checkState(!isRehashing(), "There is already a rehash in progress."); StateTableEntry<K, N, S>[] oldTable = primaryTable; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { return; } incrementalRehashTable = makeTable(oldCapacity * 2); }
/** * Doubles the capacity of the hash table. Existing entries are placed in * the correct bucket on the enlarged table. If the current capacity is, * MAXIMUM_CAPACITY, this method is a no-op. Returns the table, which * will be new unless we were already at MAXIMUM_CAPACITY. */ private void doubleCapacity() { // There can only be one rehash in flight. From the amount of incremental rehash steps we take, this should always hold. Preconditions.checkState(!isRehashing(), "There is already a rehash in progress."); StateTableEntry<K, N, S>[] oldTable = primaryTable; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { return; } incrementalRehashTable = makeTable(oldCapacity * 2); }
/** * Doubles the capacity of the hash table. Existing entries are placed in * the correct bucket on the enlarged table. If the current capacity is, * MAXIMUM_CAPACITY, this method is a no-op. Returns the table, which * will be new unless we were already at MAXIMUM_CAPACITY. */ private void doubleCapacity() { // There can only be one rehash in flight. From the amount of incremental rehash steps we take, this should always hold. Preconditions.checkState(!isRehashing(), "There is already a rehash in progress."); StateTableEntry<K, N, S>[] oldTable = primaryTable; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { return; } incrementalRehashTable = makeTable(oldCapacity * 2); }
/** * Doubles the capacity of the hash table. Existing entries are placed in * the correct bucket on the enlarged table. If the current capacity is, * MAXIMUM_CAPACITY, this method is a no-op. Returns the table, which * will be new unless we were already at MAXIMUM_CAPACITY. */ private void doubleCapacity() { // There can only be one rehash in flight. From the amount of incremental rehash steps we take, this should always hold. Preconditions.checkState(!isRehashing(), "There is already a rehash in progress."); StateTableEntry<K, N, S>[] oldTable = primaryTable; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { return; } incrementalRehashTable = makeTable(oldCapacity * 2); }