protected void rehash() { int oldCapacity = table.length; ENTRY oldMap[] = table; int newCapacity = oldCapacity * 2 + 1; ENTRY newMap[] = new ENTRY[newCapacity]; threshold = (int) (newCapacity * loadFactor); table = newMap; for (int i = oldCapacity; i-- > 0;) { for (ENTRY<K, V> old = oldMap[i]; old != null;) { ENTRY<K, V> e = old; old = old.next; K key = e.key; int index = hash(key) % newCapacity; e.next = newMap[index]; newMap[index] = e; } } }
protected void rehash() { int oldCapacity = table.length; ENTRY oldMap[] = table; int newCapacity = oldCapacity * 2 + 1; ENTRY newMap[] = new ENTRY[newCapacity]; threshold = (int) (newCapacity * loadFactor); table = newMap; for (int i = oldCapacity; i-- > 0;) { for (ENTRY<K, V> old = oldMap[i]; old != null;) { ENTRY<K, V> e = old; old = old.next; K key = e.key; int index = hash(key) % newCapacity; e.next = newMap[index]; newMap[index] = e; } } }
protected void rehash() { int oldCapacity = table.length; ENTRY oldMap[] = table; int newCapacity = oldCapacity * 2 + 1; ENTRY newMap[] = new ENTRY[newCapacity]; threshold = (int) (newCapacity * loadFactor); table = newMap; for (int i = oldCapacity; i-- > 0;) { for (ENTRY<K, V> old = oldMap[i]; old != null;) { ENTRY<K, V> e = old; old = old.next; K key = e.key; int index = hash(key) % newCapacity; e.next = newMap[index]; newMap[index] = e; } } }
protected void rehash() { int oldCapacity = table.length; ENTRY oldMap[] = table; int newCapacity = oldCapacity * 2 + 1; ENTRY newMap[] = new ENTRY[newCapacity]; threshold = (int) (newCapacity * loadFactor); table = newMap; for (int i = oldCapacity; i-- > 0;) { for (ENTRY<K, V> old = oldMap[i]; old != null;) { ENTRY<K, V> e = old; old = old.next; K key = e.key; int index = hash(key) % newCapacity; e.next = newMap[index]; newMap[index] = e; } } }
protected void rehash() { int oldCapacity = table.length; ENTRY oldMap[] = table; int newCapacity = oldCapacity * 2 + 1; ENTRY newMap[] = new ENTRY[newCapacity]; threshold = (int) (newCapacity * loadFactor); table = newMap; for (int i = oldCapacity; i-- > 0;) { for (ENTRY<K, V> old = oldMap[i]; old != null;) { ENTRY<K, V> e = old; old = old.next; K key = e.key; int index = hash(key) % newCapacity; e.next = newMap[index]; newMap[index] = e; } } }
public synchronized V remove(Object key) { if (key == null) return null; ENTRY<K, V> tab[] = table; int index = hash(key) % tab.length; for (ENTRY<K, V> e = tab[index], prev = null; e != null; prev = e, e = e.next) { if (CompareUtil.equals(e.key, key)) { if (prev != null) { prev.next = e.next; } else { tab[index] = e.next; } count--; V oldValue = e.value; e.value = null; // unchain(e); return oldValue; } } return null; }
public synchronized V remove(Object key) { if (key == null) return null; ENTRY<K, V> tab[] = table; int index = hash(key) % tab.length; for (ENTRY<K, V> e = tab[index], prev = null; e != null; prev = e, e = e.next) { if (CompareUtil.equals(e.key, key)) { if (prev != null) { prev.next = e.next; } else { tab[index] = e.next; } count--; V oldValue = e.value; e.value = null; // unchain(e); return oldValue; } } return null; }
public synchronized V remove(Object key) { if (key == null) return null; ENTRY<K, V> tab[] = table; int index = hash(key) % tab.length; for (ENTRY<K, V> e = tab[index], prev = null; e != null; prev = e, e = e.next) { if (CompareUtil.equals(e.key, key)) { if (prev != null) { prev.next = e.next; } else { tab[index] = e.next; } count--; V oldValue = e.value; e.value = null; // unchain(e); return oldValue; } } return null; }
public synchronized V remove(Object key) { if (key == null) return null; ENTRY<K, V> tab[] = table; int index = hash(key) % tab.length; for (ENTRY<K, V> e = tab[index], prev = null; e != null; prev = e, e = e.next) { if (CompareUtil.equals(e.key, key)) { if (prev != null) { prev.next = e.next; } else { tab[index] = e.next; } count--; V oldValue = e.value; e.value = null; // unchain(e); return oldValue; } } return null; }
public synchronized V remove(Object key) { if (key == null) return null; ENTRY<K, V> tab[] = table; int index = hash(key) % tab.length; for (ENTRY<K, V> e = tab[index], prev = null; e != null; prev = e, e = e.next) { if (CompareUtil.equals(e.key, key)) { if (prev != null) { prev.next = e.next; } else { tab[index] = e.next; } count--; V oldValue = e.value; e.value = null; // unchain(e); return oldValue; } } return null; }
private ENTRY<K, V> getEntry(K key) { if (key == null) return null; ENTRY<K, V> tab[] = table; int index = hash(key) % tab.length; for (ENTRY<K, V> e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { if (e.isExpired()) { remove(e.getKey()); return null; } else { return e; } } } return null; }
private ENTRY<K, V> getEntry(K key) { if (key == null) return null; ENTRY<K, V> tab[] = table; int index = hash(key) % tab.length; for (ENTRY<K, V> e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { if (e.isExpired()) { remove(e.getKey()); return null; } else { return e; } } } return null; }
private ENTRY<K, V> getEntry(K key) { if (key == null) return null; ENTRY<K, V> tab[] = table; int index = hash(key) % tab.length; for (ENTRY<K, V> e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { if (e.isExpired()) { remove(e.getKey()); return null; } else { return e; } } } return null; }
private ENTRY<K, V> getEntry(K key) { if (key == null) return null; ENTRY<K, V> tab[] = table; int index = hash(key) % tab.length; for (ENTRY<K, V> e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { if (e.isExpired()) { remove(e.getKey()); return null; } else { return e; } } } return null; }
private ENTRY<K, V> getEntry(K key) { if (key == null) return null; ENTRY<K, V> tab[] = table; int index = hash(key) % tab.length; for (ENTRY<K, V> e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { if (e.isExpired()) { remove(e.getKey()); return null; } else { return e; } } } return null; }