protected void rehash() { int oldCapacity = table.length; StringIntLinkedEntry oldMap[] = table; int newCapacity = oldCapacity * 2 + 1; StringIntLinkedEntry newMap[] = new StringIntLinkedEntry[newCapacity]; threshold = (int) (newCapacity * loadFactor); table = newMap; for (int i = oldCapacity; i-- > 0;) { StringIntLinkedEntry old = oldMap[i]; while (old != null) { StringIntLinkedEntry e = old; old = old.next; String key = e.key; int index = hash(key) % newCapacity; e.next = newMap[index]; newMap[index] = e; } } }
protected void rehash() { int oldCapacity = table.length; StringIntLinkedEntry oldMap[] = table; int newCapacity = oldCapacity * 2 + 1; StringIntLinkedEntry newMap[] = new StringIntLinkedEntry[newCapacity]; threshold = (int) (newCapacity * loadFactor); table = newMap; for (int i = oldCapacity; i-- > 0;) { StringIntLinkedEntry old = oldMap[i]; while (old != null) { StringIntLinkedEntry e = old; old = old.next; String key = e.key; int index = hash(key) % newCapacity; e.next = newMap[index]; newMap[index] = e; } } }
protected void rehash() { int oldCapacity = table.length; StringIntLinkedEntry oldMap[] = table; int newCapacity = oldCapacity * 2 + 1; StringIntLinkedEntry newMap[] = new StringIntLinkedEntry[newCapacity]; threshold = (int) (newCapacity * loadFactor); table = newMap; for (int i = oldCapacity; i-- > 0;) { StringIntLinkedEntry old = oldMap[i]; while (old != null) { StringIntLinkedEntry e = old; old = old.next; String key = e.key; int index = hash(key) % newCapacity; e.next = newMap[index]; newMap[index] = e; } } }
protected void rehash() { int oldCapacity = table.length; StringIntLinkedEntry oldMap[] = table; int newCapacity = oldCapacity * 2 + 1; StringIntLinkedEntry newMap[] = new StringIntLinkedEntry[newCapacity]; threshold = (int) (newCapacity * loadFactor); table = newMap; for (int i = oldCapacity; i-- > 0;) { StringIntLinkedEntry old = oldMap[i]; while (old != null) { StringIntLinkedEntry e = old; old = old.next; String key = e.key; int index = hash(key) % newCapacity; e.next = newMap[index]; newMap[index] = e; } } }
protected void rehash() { int oldCapacity = table.length; StringIntLinkedEntry oldMap[] = table; int newCapacity = oldCapacity * 2 + 1; StringIntLinkedEntry newMap[] = new StringIntLinkedEntry[newCapacity]; threshold = (int) (newCapacity * loadFactor); table = newMap; for (int i = oldCapacity; i-- > 0;) { StringIntLinkedEntry old = oldMap[i]; while (old != null) { StringIntLinkedEntry e = old; old = old.next; String key = e.key; int index = hash(key) % newCapacity; e.next = newMap[index]; newMap[index] = e; } } }
public synchronized int get(String key) { if (key == null) return NONE; StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { return e.value; } } return NONE; }
public synchronized int get(String key) { if (key == null) return NONE; StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { return e.value; } } return NONE; }
public synchronized int get(String key) { if (key == null) return NONE; StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { return e.value; } } return NONE; }
public synchronized int get(String key) { if (key == null) return NONE; StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { return e.value; } } return NONE; }
public synchronized boolean containsKey(String key) { StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { return true; } } return false; }
public synchronized boolean containsKey(String key) { StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { return true; } } return false; }
public synchronized boolean containsKey(String key) { StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { return true; } } return false; }
public synchronized boolean containsKey(String key) { StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { return true; } } return false; }
public synchronized boolean containsKey(String key) { StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { return true; } } return false; }
public synchronized int get(String key) { if (key == null) return NONE; StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry e = tab[index]; e != null; e = e.next) { if (CompareUtil.equals(e.key, key)) { return e.value; } } return NONE; }
public synchronized int remove(String key) { if (key == null) return NONE; StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry 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--; int oldValue = e.value; e.value = 0; // unchain(e); return oldValue; } } return NONE; }
public synchronized int remove(String key) { if (key == null) return NONE; StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry 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--; int oldValue = e.value; e.value = 0; // unchain(e); return oldValue; } } return NONE; }
public synchronized int remove(String key) { if (key == null) return NONE; StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry 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--; int oldValue = e.value; e.value = 0; // unchain(e); return oldValue; } } return NONE; }
public synchronized int remove(String key) { if (key == null) return NONE; StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry 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--; int oldValue = e.value; e.value = 0; // unchain(e); return oldValue; } } return NONE; }
public synchronized int remove(String key) { if (key == null) return NONE; StringIntLinkedEntry tab[] = table; int index = hash(key) % tab.length; for (StringIntLinkedEntry 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--; int oldValue = e.value; e.value = 0; // unchain(e); return oldValue; } } return NONE; }