private void rehash(int capacity) {
        int newCapacity = size > maxSize ? nextPrime(capacity << 1) : capacity;

        int oldCapacity = set.length;

        long[] oldKeys = set;
        int[] oldVals = values;

        set = new long[newCapacity];
        values = new int[newCapacity];

        for (int i = oldCapacity; i-- > 0; ) {
            long key = oldKeys[i];
            if (key != 0) {
                values[insertKey(key)] = oldVals[i];
            }
        }
    }
Look until FREE slot or we start to loop
core/src/main/java/com/alibaba/fastjson2/internal/trove/map/hash/TLongIntHashMap.java