public static void main(String[] args) { FlexibleHashMap<String,Integer> map = new FlexibleHashMap<String,Integer>(); map.put("hi", 1); map.put("mom", 2); map.put("foo", 3); map.put("ach", 4); map.put("cbba", 5); map.put("d", 6); map.put("edf", 7); map.put("mom", 8); map.put("hi", 9); System.out.println(map); System.out.println(map.toTableString()); } }
protected void expand() { LinkedList<Entry<K, V>>[] old = buckets; currentPrime += 4; int newCapacity = buckets.length * 2; LinkedList<Entry<K, V>>[] newTable = createEntryListArray(newCapacity); buckets = newTable; threshold = (int)(newCapacity * LOAD_FACTOR); // System.out.println("new size="+newCapacity+", thres="+threshold); // rehash all existing entries int oldSize = size(); for (LinkedList<Entry<K, V>> bucket : old) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; put(e.key, e.value); } } n = oldSize; }
public static void main(String[] args) { FlexibleHashMap<String,Integer> map = new FlexibleHashMap<String,Integer>(); map.put("hi", 1); map.put("mom", 2); map.put("foo", 3); map.put("ach", 4); map.put("cbba", 5); map.put("d", 6); map.put("edf", 7); map.put("mom", 8); map.put("hi", 9); System.out.println(map); System.out.println(map.toTableString()); } }
public static void main(String[] args) { FlexibleHashMap<String,Integer> map = new FlexibleHashMap<String,Integer>(); map.put("hi", 1); map.put("mom", 2); map.put("foo", 3); map.put("ach", 4); map.put("cbba", 5); map.put("d", 6); map.put("edf", 7); map.put("mom", 8); map.put("hi", 9); System.out.println(map); System.out.println(map.toTableString()); } }
public static void main(String[] args) { FlexibleHashMap<String,Integer> map = new FlexibleHashMap<String,Integer>(); map.put("hi", 1); map.put("mom", 2); map.put("foo", 3); map.put("ach", 4); map.put("cbba", 5); map.put("d", 6); map.put("edf", 7); map.put("mom", 8); map.put("hi", 9); System.out.println(map); System.out.println(map.toTableString()); } }
public static void main(String[] args) { FlexibleHashMap<String,Integer> map = new FlexibleHashMap<String,Integer>(); map.put("hi", 1); map.put("mom", 2); map.put("foo", 3); map.put("ach", 4); map.put("cbba", 5); map.put("d", 6); map.put("edf", 7); map.put("mom", 8); map.put("hi", 9); System.out.println(map); System.out.println(map.toTableString()); } }
protected void expand() { LinkedList<Entry<K, V>>[] old = buckets; currentPrime += 4; int newCapacity = buckets.length * 2; LinkedList<Entry<K, V>>[] newTable = createEntryListArray(newCapacity); buckets = newTable; threshold = (int)(newCapacity * LOAD_FACTOR); // System.out.println("new size="+newCapacity+", thres="+threshold); // rehash all existing entries int oldSize = size(); for (LinkedList<Entry<K, V>> bucket : old) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; put(e.key, e.value); } } n = oldSize; }
protected void expand() { LinkedList<Entry<K, V>>[] old = buckets; currentPrime += 4; int newCapacity = buckets.length * 2; LinkedList<Entry<K, V>>[] newTable = createEntryListArray(newCapacity); buckets = newTable; threshold = (int)(newCapacity * LOAD_FACTOR); // System.out.println("new size="+newCapacity+", thres="+threshold); // rehash all existing entries int oldSize = size(); for (LinkedList<Entry<K, V>> bucket : old) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; put(e.key, e.value); } } n = oldSize; }
protected void expand() { LinkedList<Entry<K, V>>[] old = buckets; currentPrime += 4; int newCapacity = buckets.length * 2; LinkedList<Entry<K, V>>[] newTable = createEntryListArray(newCapacity); buckets = newTable; threshold = (int)(newCapacity * LOAD_FACTOR); // System.out.println("new size="+newCapacity+", thres="+threshold); // rehash all existing entries int oldSize = size(); for (LinkedList<Entry<K, V>> bucket : old) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; put(e.key, e.value); } } n = oldSize; }
protected void expand() { LinkedList<Entry<K, V>>[] old = buckets; currentPrime += 4; int newCapacity = buckets.length * 2; LinkedList<Entry<K, V>>[] newTable = createEntryListArray(newCapacity); buckets = newTable; threshold = (int)(newCapacity * LOAD_FACTOR); // System.out.println("new size="+newCapacity+", thres="+threshold); // rehash all existing entries int oldSize = size(); for (LinkedList<Entry<K, V>> bucket : old) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; put(e.key, e.value); } } n = oldSize; }