Created
July 14, 2013 07:20
-
-
Save lichenbo/5993490 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public V put(K key, V value) { | |
if (key == null) | |
return putForNullKey(value); | |
int hash = hash(key.hashCode()); | |
int i = indexFor(hash, table.length); | |
for (Entry<K,V> e = table[i]; e != null; e = e.next) { | |
Object k; | |
if (e.hash == hash && ((k = e.key) == key || key.equals(k))) { | |
V oldValue = e.value; | |
e.value = value; | |
e.recordAccess(this); | |
return oldValue; | |
} | |
} | |
modCount++; | |
addEntry(hash, key, value, i); | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment