Lines Matching refs:hash

111         int hash = hash(key);
115 V current = getEntryValue(key, hash, table[index(hash, table)]);
122 current = getEntryValue(key, hash, this.table[index(hash, this.table)]);
128 int index = index(hash, this.table);
129 this.table[index] = new CacheEntry<>(hash, key, value, this.table[index]);
162 int hash = hash(key);
163 int index = index(hash, this.table);
168 if (entry.matches(hash, key)) {
207 * Retrieves object hash code and applies a supplemental hash function
208 * to the result hash, which defends against poor quality hash functions.
209 * This is critical because {@code Cache} uses power-of-two length hash tables,
213 * @param key the object which hash code is to be calculated
214 * @return a hash code value for the specified object
216 private int hash(Object key) {
218 int hash = System.identityHashCode(key);
219 return (hash << 1) - (hash << 8);
221 int hash = key.hashCode();
225 hash ^= (hash >>> 20) ^ (hash >>> 12);
226 return hash ^ (hash >>> 7) ^ (hash >>> 4);
230 * Returns index of the specified hash code in the given table.
233 * @param hash the hash code
235 * @return an index of the specified hash code in the given table
237 private static int index(int hash, Object[] table) {
238 return hash & (table.length - 1);
252 private V getEntryValue(K key, int hash, CacheEntry<K,V> entry) {
254 if (entry.matches(hash, key)) {
273 int index = index(owner.hash, this.table);
309 int newIndex = index(entry.hash, newTable);
322 private final int hash;
330 * @param hash the hash code calculated for the entry key
335 private CacheEntry(int hash, K key, V value, CacheEntry<K,V> next) {
336 this.hash = hash;
343 * Determines whether the entry has the given key with the given hash code.
345 * @param hash an expected hash code
347 * @return {@code true} if the entry has the given key with the given hash code;
350 private boolean matches(int hash, Object object) {
351 if (this.hash != hash) {