for (int i = 0; i < tab.length; ++i) { for (HashEntry<K,V> e = tab[i]; e != null; e = e.next) { K key = e.key(); if (key == null) // Skip GC'd keys continue;
for (int i = 0; i < tab.length; ++i) { for (HashEntry<K,V> e = tab[i]; e != null; e = e.next) { K key = e.key(); if (key == null) // Skip GC'd keys continue;
boolean replace(K key, int hash, V oldValue, V newValue) { lock(); try { removeStale(); HashEntry<K,V> e = getFirst(hash); while (e != null && (e.hash != hash || !keyEq(key, e.key()))) e = e.next; boolean replaced = false; if (e != null && oldValue.equals(e.value())) { replaced = true; e.setValue(newValue, valueType, refQueue); } return replaced; } finally { unlock(); } }
K key = p.key(); if (key == null) { reduce++;
K key = p.key(); if (key == null) { reduce++;
HashEntry<K,V> first = tab[index]; HashEntry<K,V> e = first; while (e != null && (e.hash != hash || !keyEq(key, e.key()))) e = e.next;
HashEntry<K,V> first = tab[index]; HashEntry<K,V> e = first; while (e != null && (e.hash != hash || !keyEq(key, e.key()))) e = e.next;
boolean replace(K key, int hash, V oldValue, V newValue) { lock(); try { removeStale(); HashEntry<K,V> e = getFirst(hash); while (e != null && (e.hash != hash || !keyEq(key, e.key()))) e = e.next; boolean replaced = false; if (e != null && oldValue.equals(e.value())) { replaced = true; e.setValue(newValue, valueType, refQueue); } return replaced; } finally { unlock(); } }
V replace(K key, int hash, V newValue) { lock(); try { removeStale(); HashEntry<K,V> e = getFirst(hash); while (e != null && (e.hash != hash || !keyEq(key, e.key()))) e = e.next; V oldValue = null; if (e != null) { oldValue = e.value(); e.setValue(newValue, valueType, refQueue); } return oldValue; } finally { unlock(); } }
V replace(K key, int hash, V newValue) { lock(); try { removeStale(); HashEntry<K,V> e = getFirst(hash); while (e != null && (e.hash != hash || !keyEq(key, e.key()))) e = e.next; V oldValue = null; if (e != null) { oldValue = e.value(); e.setValue(newValue, valueType, refQueue); } return oldValue; } finally { unlock(); } }
V get(Object key, int hash) { if (count != 0) { // read-volatile HashEntry<K,V> e = getFirst(hash); while (e != null) { if (e.hash == hash && keyEq(key, e.key())) { Object opaque = e.valueRef; if (opaque != null) return e.dereferenceValue(opaque); return readValueUnderLock(e); // recheck } e = e.next; } } return null; }
V get(Object key, int hash) { if (count != 0) { // read-volatile HashEntry<K,V> e = getFirst(hash); while (e != null) { if (e.hash == hash && keyEq(key, e.key())) { Object opaque = e.valueRef; if (opaque != null) return e.dereferenceValue(opaque); return readValueUnderLock(e); // recheck } e = e.next; } } return null; }
boolean containsKey(Object key, int hash) { if (count != 0) { // read-volatile HashEntry<K,V> e = getFirst(hash); while (e != null) { if (e.hash == hash && keyEq(key, e.key())) return true; e = e.next; } } return false; }
boolean containsKey(Object key, int hash) { if (count != 0) { // read-volatile HashEntry<K,V> e = getFirst(hash); while (e != null) { if (e.hash == hash && keyEq(key, e.key())) return true; e = e.next; } } return false; }