Skip to content

Instantly share code, notes, and snippets.

View linnykoleh's full-sized avatar
🎯
Focusing

Oleh Linnyk linnykoleh

🎯
Focusing
View GitHub Profile
@linnykoleh
linnykoleh / get.java
Created March 29, 2017 04:02
Getting value from an array
public V get(Object key) {
final int hashCodeForKey = hash(key);
final Node<K,V> nodeByKey = getNode(hashCodeForKey, key);
return nodeByKey == null ? null : nodeByKey.value;
}
private Node<K,V> getNode(int hashCodeKey, Object keySearch) {
Node<K,V> current;
Node<K,V> next;
K keyForNode;