public final void moveToEnd(E element) {
        if (element.prev() == INVALID_INDEX || element.next() == INVALID_INDEX) {
            throw new RuntimeException("Element " + element + " is not in the collection.");
        }
        Element prevElement = indexToElement(head, elements, element.prev());
        Element nextElement = indexToElement(head, elements, element.next());
        int slot = prevElement.next();
        prevElement.setNext(element.next());
        nextElement.setPrev(element.prev());
        addToListTail(head, elements, slot);
    }
Moves an element which is already in the collection so that it comes last
in iteration order.
clients/src/main/java/org/apache/kafka/common/utils/ImplicitLinkedHashCollection.java