code: public int indexOf(KType key) {
      final int mask = this.mask;
      if (Intrinsics.<KType> isEmpty(key)) {
        return hasEmptyKey ? mask + 1 : ~(mask + 1);
      } else {
        final KType[] keys = Intrinsics.<KType[]> cast(this.keys);
        int slot = hashKey(key) & mask;
  
        KType existing;
        while (!Intrinsics.<KType> isEmpty(existing = keys[slot])) {
          if (Intrinsics.<KType> equals(this, key, existing)) {
            return slot;
          }
          slot = (slot + 1) & mask;
        }
  
        return ~slot;
      }
    }
docs: Returns a logical "index" of a given key that can be used to speed up
  follow-up logic in certain scenarios (conditional logic).
  
  The semantics of "indexes" are not strictly defined. Indexes may
  (and typically won't be) contiguous.
  
  The index is valid only between modifications (it will not be affected
  by read-only operations).
  
  @see #indexExists
  @see #indexGet
  @see #indexInsert
  @see #indexReplace
  
  @param key
  The key to locate in the set.
  @return A non-negative value of the logical "index" of the key in the set
  or a negative value if the key did not exist.