static List<RecordAccumulator.WALObject> getContinuousFromTrimOffset(List<RecordAccumulator.WALObject> objectList, long trimOffset) {
            if (objectList.isEmpty()) {
                return Collections.emptyList();
            }

            int startIndex = objectList.size();
            for (int i = 0; i < objectList.size(); i++) {
                if (objectList.get(i).endOffset() > trimOffset) {
                    startIndex = i;
                    break;
                }
            }
            if (startIndex > 0) {
                for (int i = 0; i < startIndex; i++) {
                    log.warn("drop trimmed object: {}", objectList.get(i));
                }
            }
            if (startIndex >= objectList.size()) {
                return Collections.emptyList();
            }

            int endIndex = startIndex + 1;
            for (int i = startIndex + 1; i < objectList.size(); i++) {
                if (objectList.get(i).startOffset() != objectList.get(i - 1).endOffset()) {
                    break;
                }
                endIndex = i + 1;
            }
            if (endIndex < objectList.size()) {
                for (int i = endIndex; i < objectList.size(); i++) {
                    log.warn("drop discontinuous object: {}", objectList.get(i));
                }
            }

            return new ArrayList<>(objectList.subList(startIndex, endIndex));
        }
Get the latest trim offset from the newest object.
s3stream/src/main/java/com/automq/stream/s3/wal/impl/object/ObjectWALService.java