private void putStash(K key, int value) { if (stashSize == stashCapacity) { // Too many pushes occurred and the stash is full, increase the table size. resize(capacity << 1); put(key, value); return; } // Update key in the stash. K[] keyTable = this.keyTable; for (int i = capacity, n = i + stashSize; i < n; i++) { if (key.equals(keyTable[i])) { valueTable[i] = value; return; } } // Store key in the stash. int index = capacity + stashSize; keyTable[index] = key; valueTable[index] = value; stashSize++; }
public void putAll(ObjectIntMap<K> map) { for (Entry<K> entry : map.entries()) put(entry.key, entry.value); }