@Override
        public void remove() {
            if (lastReturned == null) {
                throw new IllegalStateException();
            }
            Element nextElement = indexToElement(head, elements, lastReturned.next());
            ImplicitLinkedHashCollection.this.removeElementAtSlot(nextElement.prev());
            if (lastReturned == cur) {
                // If the element we are removing was cur, set cur to cur->next.
                cur = nextElement;
            } else {
                // If the element we are removing comes before cur, decrement the index,
                // since there are now fewer entries before cur.
                --index;
            }
            lastReturned = null;
        }
A static empty array used to avoid object allocations when the capacity is zero.
clients/src/main/java/org/apache/kafka/common/utils/ImplicitLinkedHashCollection.java