code: private void expandAndRehash() {
      final int[] newHashSet = new int[hashSet.length * 2];
      final int bucketMask = (newHashSet.length - 1);
  
      for (int j = 0; j < hashSet.length; j++) {
        final int state = hashSet[j];
        if (state > 0) {
          int slot = hash(state, stateLength(state)) & bucketMask;
          for (int i = 0; newHashSet[slot] > 0;) {
            slot = (slot + (++i)) & bucketMask;
          }
          newHashSet[slot] = state;
        }
      }
      this.hashSet = newHashSet;
    }
docs: Reallocate and rehash the hash set.