code: private int freezeState(final int activePathIndex) {
      final int start = activePath[activePathIndex];
      final int end = nextArcOffset[activePathIndex];
      final int len = end - start;
  
      // Set the last arc flag on the current active path's state.
      serialized[end - ARC_SIZE + FLAGS_OFFSET] |= BIT_ARC_LAST;
  
      // Try to locate a state with an identical content in the hash set.
      final int bucketMask = (hashSet.length - 1);
      int slot = hash(start, len) & bucketMask;
      for (int i = 0;;) {
        int state = hashSet[slot];
        if (state == 0) {
          state = hashSet[slot] = serialize(activePathIndex);
          if (++hashSize > hashSet.length / 2)
            expandAndRehash();
          return state;
        } else if (equivalent(state, start, len)) {
          return state;
        }
  
        slot = (slot + (++i)) & bucketMask;
      }
    }
docs: Freeze a state: try to find an equivalent state in the interned states
  dictionary first, if found, return it, otherwise, serialize the mutable
  state at <code>activePathIndex</code> and return it.