private void rehash()

in statefun-flink/statefun-flink-core/src/main/java/it/unimi/dsi/fastutil/objects/ObjectOpenHashMap.java [335:357]


  private void rehash(final int newN) {
    final K key[] = this.key;
    final V value[] = this.value;
    final int mask = newN - 1; // Note that this is used by the hashing macro
    final K newKey[] = (K[]) new Object[newN + 1];
    final V newValue[] = (V[]) new Object[newN + 1];
    int i = n, pos;
    for (int j = realSize(); j-- != 0; ) {
      while (((key[--i]) == null)) {}
      if (!((newKey[pos = (it.unimi.dsi.fastutil.HashCommon.mix((key[i]).hashCode())) & mask])
          == null)) {
        while (!((newKey[pos = (pos + 1) & mask]) == null)) {}
      }
      newKey[pos] = key[i];
      newValue[pos] = value[i];
    }
    newValue[newN] = value[n];
    n = newN;
    this.mask = mask;
    maxFill = maxFill(n, f);
    this.key = newKey;
    this.value = newValue;
  }