question: public static Long nextLogSegmentSequenceNumber ( List < LogSegmentMetadata > segmentListDesc ) { int lastAssignedLogSegmentIdx = - 1 ; Long lastAssignedLogSegmentSeqNo = null ; Long nextLogSegmentSeqNo = null ; for ( int i = 0 ; i < segmentListDesc . size ( ) ; i ++ ) { LogSegmentMetadata metadata = segmentListDesc . get ( i ) ; if ( LogSegmentMetadata . supportsLogSegmentSequenceNo ( metadata . getVersion ( ) ) ) { lastAssignedLogSegmentSeqNo = metadata . getLogSegmentSequenceNumber ( ) ; lastAssignedLogSegmentIdx = i ; break ; } } if ( null != lastAssignedLogSegmentSeqNo ) { nextLogSegmentSeqNo = lastAssignedLogSegmentSeqNo + lastAssignedLogSegmentIdx + 1 ; } return nextLogSegmentSeqNo ; }
target:  Assign next log segment sequence number based on a decreasing list of log segments.