public Optional<LogSegment> get(long offset) {
        return Optional.ofNullable(segments.get(offset));
    }
Retrieves a segment at the specified offset.

This method is thread-safe.

@param offset the segment to be retrieved

@return the segment if it exists, otherwise Empty.
storage/src/main/java/org/apache/kafka/storage/internals/log/LogSegments.java