@SuppressWarnings("unchecked")
        long[] removeFromFirst(final int toIndex) {
            int removed = 0;
            long removeBytes = 0;
            for (int i = this.offset; i < Math.min(toIndex, this.pos); i++) {
                removeBytes += ((T) this.elements[i]).estimatedSize();
                this.elements[i] = null;
                removed++;
            }
            this.offset += removed;
            this.bytes -= removeBytes;
            return new long[] { removed, removeBytes };
        }
A recyclable segment.
@author boyan(boyan@antfin.com)

@param <T>
jraft-core/src/main/java/com/alipay/sofa/jraft/util/SegmentList.java