private int findIndexOfEqualElement(Object key) {
        if (key == null || size == 0) {
            return INVALID_INDEX;
        }
        int slot = slot(elements, key);
        for (int seen = 0; seen < elements.length; seen++) {
            Element element = elements[slot];
            if (element == null) {
                return INVALID_INDEX;
            }
            if (element.elementKeysAreEqual(key)) {
                return slot;
            }
            slot = (slot + 1) % elements.length;
        }
        return INVALID_INDEX;
    }
Find an element matching an example element.

Using the element's hash code, we can look up the slot where it belongs.
However, it may not have ended up in exactly this slot, due to a collision.
Therefore, we must search forward in the array until we hit a null, before
concluding that the element is not present.

@param key               The element to match.
@return                  The match index, or INVALID_INDEX if no match was found.
clients/src/main/java/org/apache/kafka/common/utils/ImplicitLinkedHashCollection.java