long[] removeFromFirstWhen(final Predicate<T> predicate) {
            int removed = 0;
            long removedBytes = 0;
            for (int i = this.offset; i < this.pos; i++) {
                @SuppressWarnings("unchecked")
                T e = (T) this.elements[i];
                if (predicate.test(e)) {
                    removedBytes += e.estimatedSize();
                    this.elements[i] = null;
                    removed++;
                } else {
                    break;
                }
            }
            this.offset += removed;
            this.bytes -= removedBytes;
            return new long[] { removed, removedBytes };
        }
A recyclable segment.
@author boyan(boyan@antfin.com)

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