public int put(T key) {
        // check if the key already exists.
        int index = findKey(key);

        // if not, then we need to add it
        if (index == -1) {
            // make sure there is enough room
            if (indexer.getSize() >= capacity) {
                // if not enough room, grow the key capacity.
                grow();
            }
            // now use the hashcode as the listID and get a new index
            // to put on that list.  Then store the key at the new index.
            int hashcode = (key.hashCode() & 0x7FFFFFFF) % capacity;
            index = indexer.add(hashcode);

            if (index < 0) {
                throw new IndexOutOfBoundsException("Maximum capacity reached");
            }
            keys[index] = key;
        }

        // return the index associated with the given key.
        return index;

    }
Returns an index that will always be associated to the given key as long as
the key remains in the table. If the key already exists, then the index where
that key is stored is returned.  If the key is new, then a new index is allocated,
the key is stored at that index, and the new index is returned.
@param key the key to be stored.
@return index for key, or -1 if there was no room to put the key.
@exception IndexOutOfBoundsException thrown if this object is at maximum capacity.
Ghidra/Framework/Generic/src/main/java/ghidra/util/datastruct/ObjectKeyIndexer.java