@Override
public V put(K key, V value) {
assertKeyNotNull(key);
Entry<K, V>[] table = this.table;
int hash = hash(key);
int length = table.length;
int start = index(hash, length);
int index = start;
for (; ;) {
Entry<K, V> e = table[index];
if (e == null)
break;
if (e.hash == hash && eq(key, e.key)) {
table[index] = new Entry<K, V>(e.key, e.hash, value);
return e.value;
}
index = nextIndex(index, length);
if (index == start)
throw new IllegalStateException("Table is full!");
}
modCount++;
table[index] = new Entry<K, V>(key, hash, value);
if (++size >= threshold)
resize(length);
return null;
}