@Override public Collection<V> values() { List<V> a = new ArrayList<V>(size()); for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { a.add(e.value); } } return a; }
@Override public String toString() { if ( size()==0 ) return "{}"; StringBuilder buf = new StringBuilder(); buf.append('{'); boolean first = true; for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; if ( first ) first=false; else buf.append(", "); buf.append(e.toString()); } } buf.append('}'); return buf.toString(); }
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; }
@Override public int hashCode() { int hash = MurmurHash.initialize(); for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; hash = MurmurHash.update(hash, comparator.hashCode(e.key)); } } hash = MurmurHash.finish(hash, size()); return hash; }
@Override public Collection<V> values() { List<V> a = new ArrayList<V>(size()); for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { a.add(e.value); } } return a; }
@Override public Collection<V> values() { List<V> a = new ArrayList<V>(size()); for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { a.add(e.value); } } return a; }
@Override public Collection<V> values() { List<V> a = new ArrayList<V>(size()); for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { a.add(e.value); } } return a; }
@Override public Collection<V> values() { List<V> a = new ArrayList<V>(size()); for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { a.add(e.value); } } return a; }
@Override public String toString() { if ( size()==0 ) return "{}"; StringBuilder buf = new StringBuilder(); buf.append('{'); boolean first = true; for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; if ( first ) first=false; else buf.append(", "); buf.append(e.toString()); } } buf.append('}'); return buf.toString(); }
@Override public String toString() { if ( size()==0 ) return "{}"; StringBuilder buf = new StringBuilder(); buf.append('{'); boolean first = true; for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; if ( first ) first=false; else buf.append(", "); buf.append(e.toString()); } } buf.append('}'); return buf.toString(); }
@Override public String toString() { if ( size()==0 ) return "{}"; StringBuilder buf = new StringBuilder(); buf.append('{'); boolean first = true; for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; if ( first ) first=false; else buf.append(", "); buf.append(e.toString()); } } buf.append('}'); return buf.toString(); }
@Override public String toString() { if ( size()==0 ) return "{}"; StringBuilder buf = new StringBuilder(); buf.append('{'); boolean first = true; for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; if ( first ) first=false; else buf.append(", "); buf.append(e.toString()); } } buf.append('}'); return buf.toString(); }
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; }
@Override public int hashCode() { int hash = MurmurHash.initialize(); for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; hash = MurmurHash.update(hash, comparator.hashCode(e.key)); } } hash = MurmurHash.finish(hash, size()); return hash; }
@Override public int hashCode() { int hash = MurmurHash.initialize(); for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; hash = MurmurHash.update(hash, comparator.hashCode(e.key)); } } hash = MurmurHash.finish(hash, size()); return hash; }
@Override public int hashCode() { int hash = MurmurHash.initialize(); for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; hash = MurmurHash.update(hash, comparator.hashCode(e.key)); } } hash = MurmurHash.finish(hash, size()); return hash; }
@Override public int hashCode() { int hash = MurmurHash.initialize(); for (LinkedList<Entry<K, V>> bucket : buckets) { if ( bucket==null ) continue; for (Entry<K, V> e : bucket) { if ( e==null ) break; hash = MurmurHash.update(hash, comparator.hashCode(e.key)); } } hash = MurmurHash.finish(hash, size()); return hash; }