public Object next() { if (!hasNext()) throw new NoSuchElementException(); Entry e = lastReturned = entry; entry = e.getNext(); return type == KEYS ? e.getKey() : (type == VALUES ? e.getValue() : e); }
public Object next() { if (!hasNext()) throw new NoSuchElementException(); Entry e = lastReturned = entry; entry = e.getNext(); return type == KEYS ? e.getKey() : (type == VALUES ? e.getValue() : e); }
public Object next() { if (!hasNext()) throw new NoSuchElementException(); Entry e = lastReturned = entry; entry = e.getNext(); return type == KEYS ? e.getKey() : (type == VALUES ? e.getValue() : e); }
for (Entry old = oldMap[i]; old != null;) { if ((keyType != HARD && old.getKey() == null) || valueType != HARD && old.getValue() == null) { Entry e = old; old = old.getNext();
return e.getValue();
/** * Expunge stale entries from the table. */ private void expungeStaleEntries() { Object r; while ((r = queue.poll()) != null) { Entry entry = (Entry) r; int hash = entry.getHash(); Entry[] tab = table; int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index], prev = null; e != null; prev = e, e = e.getNext()) { if (e == entry) { if (prev != null) prev.setNext(e.getNext()); // otherwise put the bucket after us else tab[index] = e.getNext(); count--; if (keyType == HARD) valueExpired(e.getKey()); else keyExpired(e.getValue()); } } } }
for (Entry old = oldMap[i]; old != null;) { if ((keyType != HARD && old.getKey() == null) || valueType != HARD && old.getValue() == null) { Entry e = old; old = old.getNext();
/** * Expunge stale entries from the table. */ private void expungeStaleEntries() { Object r; while ((r = queue.poll()) != null) { Entry entry = (Entry) r; int hash = entry.getHash(); Entry[] tab = table; int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index], prev = null; e != null; prev = e, e = e.getNext()) { if (e == entry) { if (prev != null) prev.setNext(e.getNext()); // otherwise put the bucket after us else tab[index] = e.getNext(); count--; if (keyType == HARD) valueExpired(e.getKey()); else keyExpired(e.getValue()); } } } }
/** * Expunge stale entries from the table. */ private void expungeStaleEntries() { Object r; while ((r = queue.poll()) != null) { Entry entry = (Entry) r; int hash = entry.getHash(); Entry[] tab = table; int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index], prev = null; e != null; prev = e, e = e.getNext()) { if (e == entry) { if (prev != null) prev.setNext(e.getNext()); // otherwise put the bucket after us else tab[index] = e.getNext(); count--; if (keyType == HARD) valueExpired(e.getKey()); else keyExpired(e.getValue()); } } } }
/** * Expunge stale entries from the table. */ private void expungeStaleEntries() { Object r; while ((r = queue.poll()) != null) { Entry entry = (Entry) r; int hash = entry.getHash(); Entry[] tab = table; int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index], prev = null; e != null; prev = e, e = e.getNext()) { if (e == entry) { if (prev != null) prev.setNext(e.getNext()); // otherwise put the bucket after us else tab[index] = e.getNext(); count--; if (keyType == HARD) valueExpired(e.getKey()); else keyExpired(e.getValue()); } } } }
/** * Returns true if this HashMap maps one or more keys to the specified * value. * * @param value value whose presence in this Map is to be tested. */ public boolean containsValue(Object value) { Entry[] tab = table; if (value == null) { if (valueType != HARD) return false; for (int i = tab.length; i-- > 0;) for (Entry e = tab[i]; e != null; e = e.getNext()) if (e.getValue() == null) return true; } else { for (int i = tab.length; i-- > 0;) for (Entry e = tab[i]; e != null; e = e.getNext()) if (eq(value, e.getValue())) return true; } return false; }
/** * Returns true if this HashMap maps one or more keys to the specified * value. * * @param value value whose presence in this Map is to be tested. */ public boolean containsValue(Object value) { Entry[] tab = table; if (value == null) { if (valueType != HARD) return false; for (int i = tab.length; i-- > 0;) for (Entry e = tab[i]; e != null; e = e.getNext()) if (e.getValue() == null) return true; } else { for (int i = tab.length; i-- > 0;) for (Entry e = tab[i]; e != null; e = e.getNext()) if (eq(value, e.getValue())) return true; } return false; }
/** * Returns true if this HashMap maps one or more keys to the specified * value. * * @param value value whose presence in this Map is to be tested. */ public boolean containsValue(Object value) { Entry[] tab = table; if (value == null) { if (valueType != HARD) return false; for (int i = tab.length; i-- > 0;) for (Entry e = tab[i]; e != null; e = e.getNext()) if (e.getValue() == null) return true; } else { for (int i = tab.length; i-- > 0;) for (Entry e = tab[i]; e != null; e = e.getNext()) if (eq(value, e.getValue())) return true; } return false; }
/** * Returns true if this HashMap maps one or more keys to the specified * value. * * @param value value whose presence in this Map is to be tested. */ public boolean containsValue(Object value) { Entry[] tab = table; if (value == null) { if (valueType != HARD) return false; for (int i = tab.length; i-- > 0;) for (Entry e = tab[i]; e != null; e = e.getNext()) if (e.getValue() == null) return true; } else { for (int i = tab.length; i-- > 0;) for (Entry e = tab[i]; e != null; e = e.getNext()) if (eq(value, e.getValue())) return true; } return false; }
/** * Returns the value to which this HashMap maps the specified key. * Returns null if the HashMap contains no mapping for this key. * * @param key key whose associated value is to be returned. */ public Object get(Object key) { if (key == null && keyType != HARD) return null; Entry[] tab = table; int hash = hc(key); int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index]; e != null; e = e.getNext()) if ((e.getHash() == hash) && eq(key, e.getKey())) return e.getValue(); return null; }
/** * Returns the value to which this HashMap maps the specified key. * Returns null if the HashMap contains no mapping for this key. * * @param key key whose associated value is to be returned. */ public Object get(Object key) { if (key == null && keyType != HARD) return null; Entry[] tab = table; int hash = hc(key); int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index]; e != null; e = e.getNext()) if ((e.getHash() == hash) && eq(key, e.getKey())) return e.getValue(); return null; }
/** * Returns the value to which this HashMap maps the specified key. * Returns null if the HashMap contains no mapping for this key. * * @param key key whose associated value is to be returned. */ public Object get(Object key) { if (key == null && keyType != HARD) return null; Entry[] tab = table; int hash = hc(key); int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index]; e != null; e = e.getNext()) if ((e.getHash() == hash) && eq(key, e.getKey())) return e.getValue(); return null; }
/** * Returns the value to which this HashMap maps the specified key. * Returns null if the HashMap contains no mapping for this key. * * @param key key whose associated value is to be returned. */ public Object get(Object key) { if (key == null && keyType != HARD) return null; Entry[] tab = table; int hash = hc(key); int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index]; e != null; e = e.getNext()) if ((e.getHash() == hash) && eq(key, e.getKey())) return e.getValue(); return null; }
public Object next() { if (!hasNext()) throw new NoSuchElementException(); Entry e = lastReturned = entry; entry = e.getNext(); return type == KEYS ? e.getKey() : (type == VALUES ? e.getValue() : e); }