Created
January 10, 2013 18:04
-
-
Save vandershraaf/4504323 to your computer and use it in GitHub Desktop.
Internal code of HashMap.get()
This file contains hidden or 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 get(Object key) { | |
if (key == null) | |
return getForNullKey(); | |
int hash = hash(key.hashCode()); | |
for (Entry<K,V> e = table[indexFor(hash, table.length)]; | |
e != null; | |
e = e.next) { | |
Object k; | |
if (e.hash == hash && ((k = e.key) == key || key.equals(k))) | |
return e.value; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment