@Override public int hashCode() { int hashCode = 0; int mc = modCount(); Object[] keys = set; char[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { K key; // noinspection unchecked if ((key = (K) keys[i]) != FREE) { hashCode += nullableKeyHashCode(key) ^ vals[i]; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
@Override public int hashCode() { int hashCode = 0; int mc = modCount(); Object[] keys = set; char[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { K key; // noinspection unchecked if ((key = (K) keys[i]) != FREE) { hashCode += nullableKeyHashCode(key) ^ vals[i]; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
@Override void rehash(int newCapacity) { int mc = modCount(); Object[] keys = set; char[] vals = values; initForRehash(newCapacity); mc++; // modCount is incremented in initForRehash() Object[] newKeys = set; int capacityMask = newKeys.length - 1; char[] newVals = values; for (int i = keys.length - 1; i >= 0; i--) { K key; // noinspection unchecked if ((key = (K) keys[i]) != FREE) { int index; if (newKeys[index = SeparateKVObjKeyMixing.mix(nullableKeyHashCode(key)) & capacityMask] != FREE) { while (true) { if (newKeys[(index = (index - 1) & capacityMask)] == FREE) { break; } } } newKeys[index] = key; newVals[index] = vals[i]; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override void rehash(int newCapacity) { int mc = modCount(); Object[] keys = set; char[] vals = values; initForRehash(newCapacity); mc++; // modCount is incremented in initForRehash() Object[] newKeys = set; int capacityMask = newKeys.length - 1; char[] newVals = values; for (int i = keys.length - 1; i >= 0; i--) { K key; // noinspection unchecked if ((key = (K) keys[i]) != FREE) { int index; if (newKeys[index = SeparateKVObjKeyMixing.mix(nullableKeyHashCode(key)) & capacityMask] != FREE) { while (true) { if (newKeys[(index = (index - 1) & capacityMask)] == FREE) { break; } } } newKeys[index] = key; newVals[index] = vals[i]; } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }