public void clear() {
        while (!this.segments.isEmpty()) {
            RecycleUtil.recycle(this.segments.pollLast());
        }
        this.estimatedBytes = 0;
        this.size = this.firstOffset = 0;
    }
Remove elements from first until predicate returns false.

@param predicate predicate functional interface
jraft-core/src/main/java/com/alipay/sofa/jraft/util/SegmentList.java